File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1030,6 +1030,19 @@ class SyntacticElementConstraintGenerator
1030
1030
1031
1031
SmallVector<ElementInfo, 4 > elements;
1032
1032
for (auto element : braceStmt->getElements ()) {
1033
+ if (cs.isForCodeCompletion () && !cs.containsIDEInspectionTarget (element)) {
1034
+ // Statements and expressions can't influence the expresion that
1035
+ // contains the code completion token. To improve performance, skip
1036
+ // type checking them entirely.
1037
+ if (element.is <Expr *>()) {
1038
+ continue ;
1039
+ } else if (element.is <Stmt *>() && !element.isStmt (StmtKind::Guard)) {
1040
+ // Guard statements might define variables that are used in the code
1041
+ // completion expression. Don't skip them.
1042
+ continue ;
1043
+ }
1044
+ }
1045
+
1033
1046
if (auto *decl = element.dyn_cast <Decl *>()) {
1034
1047
if (auto *PDB = dyn_cast<PatternBindingDecl>(decl)) {
1035
1048
visitPatternBinding (PDB, elements);
You can’t perform that action at this time.
0 commit comments