Skip to content

Commit ca126bc

Browse files
committed
[CSGen] Closure analyzer shouldn't walk into local some decls/patterns
While trying to gather all references to external variables, analyzer shouldn't walk into patterns and any local declarations except to pattern bindings, because decls do not participate in inference and patterns cannot contain references analyzer is looking for.
1 parent 6d657c9 commit ca126bc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/CSGen.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,14 @@ namespace {
29412941

29422942
return Action::Continue(expr);
29432943
}
2944+
2945+
PreWalkAction walkToDeclPre(Decl *D) override {
2946+
return Action::VisitChildrenIf(isa<PatternBindingDecl>(D));
2947+
}
2948+
2949+
PreWalkResult<Pattern *> walkToPatternPre(Pattern *P) override {
2950+
return Action::SkipChildren(P);
2951+
}
29442952
} collectVarRefs(CS);
29452953

29462954
closure->walk(collectVarRefs);

0 commit comments

Comments
 (0)