@@ -973,7 +973,6 @@ NO_NEW_INSERTION_POINT(IfStmtScope)
973
973
NO_NEW_INSERTION_POINT(RepeatWhileScope)
974
974
NO_NEW_INSERTION_POINT(SubscriptDeclScope)
975
975
NO_NEW_INSERTION_POINT(SwitchStmtScope)
976
- NO_NEW_INSERTION_POINT(VarDeclScope)
977
976
NO_NEW_INSERTION_POINT(WhileStmtScope)
978
977
979
978
NO_EXPANSION(GenericParamScope)
@@ -1019,6 +1018,7 @@ PatternEntryDeclScope::expandAScopeThatCreatesANewInsertionPoint(
1019
1018
ScopeCreator &scopeCreator) {
1020
1019
// Initializers come before VarDecls, e.g. PCMacro/didSet.swift 19
1021
1020
auto patternEntry = getPatternEntry ();
1021
+
1022
1022
// Create a child for the initializer, if present.
1023
1023
// Cannot trust the source range given in the ASTScopeImpl for the end of the
1024
1024
// initializer (because of InterpolatedLiteralStrings and EditorPlaceHolders),
@@ -1035,10 +1035,12 @@ PatternEntryDeclScope::expandAScopeThatCreatesANewInsertionPoint(
1035
1035
.constructExpandAndInsertUncheckable <PatternEntryInitializerScope>(
1036
1036
this , decl, patternEntryIndex, vis);
1037
1037
}
1038
+
1038
1039
// Add accessors for the variables in this pattern.
1039
- forEachVarDeclWithLocalizableAccessors (scopeCreator, [&](VarDecl *var) {
1040
- scopeCreator.ifUniqueConstructExpandAndInsert <VarDeclScope>( this , var );
1040
+ patternEntry. getPattern ()-> forEachVariable ( [&](VarDecl *var) {
1041
+ scopeCreator.addChildrenForAllLocalizableAccessorsInSourceOrder (var, this );
1041
1042
});
1043
+
1042
1044
ASTScopeAssert (!handleUseBeforeDef,
1043
1045
" next line is wrong otherwise; would need a use scope" );
1044
1046
@@ -1273,11 +1275,6 @@ void CaseStmtBodyScope::expandAScopeThatDoesNotCreateANewInsertionPoint(
1273
1275
scopeCreator.addToScopeTree (stmt->getBody (), this );
1274
1276
}
1275
1277
1276
- void VarDeclScope::expandAScopeThatDoesNotCreateANewInsertionPoint (
1277
- ScopeCreator &scopeCreator) {
1278
- scopeCreator.addChildrenForAllLocalizableAccessorsInSourceOrder (decl, this );
1279
- }
1280
-
1281
1278
void SubscriptDeclScope::expandAScopeThatDoesNotCreateANewInsertionPoint (
1282
1279
ScopeCreator &scopeCreator) {
1283
1280
scopeCreator.addChildrenForKnownAttributes (decl, this );
@@ -1427,19 +1424,6 @@ AbstractPatternEntryScope::AbstractPatternEntryScope(
1427
1424
" out of bounds" );
1428
1425
}
1429
1426
1430
- void AbstractPatternEntryScope::forEachVarDeclWithLocalizableAccessors (
1431
- ScopeCreator &scopeCreator, function_ref<void (VarDecl *)> foundOne) const {
1432
- getPatternEntry ().getPattern ()->forEachVariable ([&](VarDecl *var) {
1433
- bool hasParsedAccessors = false ;
1434
- var->visitParsedAccessors ([&](AccessorDecl *) {
1435
- hasParsedAccessors = true ;
1436
- });
1437
-
1438
- if (hasParsedAccessors)
1439
- foundOne (var);
1440
- });
1441
- }
1442
-
1443
1427
// Following must be after uses to ensure templates get instantiated
1444
1428
#pragma mark getEnclosingAbstractStorageDecl
1445
1429
@@ -1531,7 +1515,6 @@ GET_REFERRENT(AbstractFunctionDeclScope, getDecl())
1531
1515
GET_REFERRENT(PatternEntryDeclScope, getPattern())
1532
1516
GET_REFERRENT(TopLevelCodeScope, getDecl())
1533
1517
GET_REFERRENT(SubscriptDeclScope, getDecl())
1534
- GET_REFERRENT(VarDeclScope, getDecl())
1535
1518
GET_REFERRENT(GenericParamScope, paramList->getParams ()[index])
1536
1519
GET_REFERRENT(AbstractStmtScope, getStmt())
1537
1520
GET_REFERRENT(CaptureListScope, getExpr())
0 commit comments