From b485e18e044c3345c9544c0d0176293772d70f95 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 23 Mar 2024 09:13:07 +0800 Subject: [PATCH] fix: lambda expression capture support --- RedPandaIDE/widgets/codecompletionpopup.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index de2e7f78..118d0411 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -701,14 +701,17 @@ void CodeCompletionPopup::getCompletionFor( if (scopeStatement->lambdaCaptures.contains("&") || scopeStatement->lambdaCaptures.contains("=")) { scopeStatement = scopeStatement->parentScope.lock(); - continue; } else if (scopeStatement->lambdaCaptures.contains("this")) { do { scopeStatement = scopeStatement->parentScope.lock(); - } while (scopeStatement && scopeStatement->kind!=StatementKind::skClass); - continue; + } while (scopeStatement && scopeStatement->kind!=StatementKind::skClass + && scopeStatement->kind!=StatementKind::skNamespace); + } else { + do { + scopeStatement = scopeStatement->parentScope.lock(); + } while (scopeStatement && scopeStatement->kind!=StatementKind::skNamespace); } - break; + continue; } scopeStatement=scopeStatement->parentScope.lock(); }