Skip to content

Commit 9119f73

Browse files
committed
ASTScope: PatternEntryInitializerScope does not change the insertion point
1 parent f1d2db5 commit 9119f73

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

include/swift/AST/ASTScope.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,7 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
11091109
ASTScopeImpl *expandSpecifically(ScopeCreator &scopeCreator) override;
11101110

11111111
private:
1112-
AnnotatedInsertionPoint
1113-
expandAScopeThatCreatesANewInsertionPoint(ScopeCreator &);
1112+
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
11141113

11151114
public:
11161115
std::string getClassName() const override;

lib/AST/ASTScopeCreation.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ CREATES_NEW_INSERTION_POINT(ASTSourceFileScope)
948948
CREATES_NEW_INSERTION_POINT(ConditionalClauseScope)
949949
CREATES_NEW_INSERTION_POINT(GuardStmtScope)
950950
CREATES_NEW_INSERTION_POINT(PatternEntryDeclScope)
951-
CREATES_NEW_INSERTION_POINT(PatternEntryInitializerScope)
952951
CREATES_NEW_INSERTION_POINT(GenericTypeOrExtensionScope)
953952
CREATES_NEW_INSERTION_POINT(BraceStmtScope)
954953
CREATES_NEW_INSERTION_POINT(TopLevelCodeScope)
@@ -958,6 +957,7 @@ NO_NEW_INSERTION_POINT(AbstractFunctionDeclScope)
958957
NO_NEW_INSERTION_POINT(AttachedPropertyWrapperScope)
959958
NO_NEW_INSERTION_POINT(EnumElementScope)
960959
NO_NEW_INSERTION_POINT(ParameterListScope)
960+
NO_NEW_INSERTION_POINT(PatternEntryInitializerScope)
961961

962962
NO_NEW_INSERTION_POINT(CaptureListScope)
963963
NO_NEW_INSERTION_POINT(CaseStmtScope)
@@ -1046,19 +1046,12 @@ PatternEntryDeclScope::expandAScopeThatCreatesANewInsertionPoint(
10461046
"code just goes in the same scope as this one"};
10471047
}
10481048

1049-
AnnotatedInsertionPoint
1050-
PatternEntryInitializerScope::expandAScopeThatCreatesANewInsertionPoint(
1049+
void
1050+
PatternEntryInitializerScope::expandAScopeThatDoesNotCreateANewInsertionPoint(
10511051
ScopeCreator &scopeCreator) {
10521052
// Create a child for the initializer expression.
10531053
scopeCreator.addToScopeTree(ASTNode(getPatternEntry().getOriginalInit()),
10541054
this);
1055-
if (handleUseBeforeDef)
1056-
return {this, "PatternEntryDeclScope::expand.* needs initializer scope to "
1057-
"get its endpoint in order to push back start of "
1058-
"PatternEntryUseScope"};
1059-
1060-
// null pointer here blows up request printing
1061-
return {getParent().get(), "Unused"};
10621055
}
10631056

10641057
AnnotatedInsertionPoint

0 commit comments

Comments
 (0)