fix: lambda expression capture support

This commit is contained in:
Roy Qu 2024-03-23 09:13:07 +08:00
parent 09a61c4c32
commit b485e18e04
1 changed files with 7 additions and 4 deletions

View File

@ -701,14 +701,17 @@ void CodeCompletionPopup::getCompletionFor(
if (scopeStatement->lambdaCaptures.contains("&") if (scopeStatement->lambdaCaptures.contains("&")
|| scopeStatement->lambdaCaptures.contains("=")) { || scopeStatement->lambdaCaptures.contains("=")) {
scopeStatement = scopeStatement->parentScope.lock(); scopeStatement = scopeStatement->parentScope.lock();
continue;
} else if (scopeStatement->lambdaCaptures.contains("this")) { } else if (scopeStatement->lambdaCaptures.contains("this")) {
do { do {
scopeStatement = scopeStatement->parentScope.lock(); scopeStatement = scopeStatement->parentScope.lock();
} while (scopeStatement && scopeStatement->kind!=StatementKind::skClass); } while (scopeStatement && scopeStatement->kind!=StatementKind::skClass
continue; && scopeStatement->kind!=StatementKind::skNamespace);
} else {
do {
scopeStatement = scopeStatement->parentScope.lock();
} while (scopeStatement && scopeStatement->kind!=StatementKind::skNamespace);
} }
break; continue;
} }
scopeStatement=scopeStatement->parentScope.lock(); scopeStatement=scopeStatement->parentScope.lock();
} }