@@ -474,16 +474,6 @@ class ASTScopeImpl {
474
474
NullablePtr<const GenericParamList> lastListSearched,
475
475
DeclConsumer consumer) const ;
476
476
477
- public:
478
- // / Returns the SelfDC for parent (and possibly ancestor) scopes.
479
- // / A return of None indicates that the previous child (in history) should be
480
- // / asked.
481
- virtual Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const ;
482
-
483
- // / Returns the context that should be used when a nested scope (e.g. a
484
- // / closure) captures self explicitly.
485
- virtual NullablePtr<DeclContext> capturedSelfDC () const ;
486
-
487
477
protected:
488
478
// / Find either locals or members (no scope has both)
489
479
// / \param history The scopes visited since the start of lookup (including
@@ -691,27 +681,6 @@ class Portion {
691
681
bool lookupMembersOf (const GenericTypeOrExtensionScope *scope,
692
682
ArrayRef<const ASTScopeImpl *>,
693
683
ASTScopeImpl::DeclConsumer consumer) const override ;
694
-
695
- private:
696
- // / A client needs to know if a lookup result required the dynamic implicit
697
- // / self value. It is required if the lookup originates from a method body
698
- // / or a lazy pattern initializer. So, one approach would be to call the
699
- // / consumer to find members right from those scopes. However, because
700
- // / members aren't the first things searched, generics are, that approache
701
- // / ends up duplicating code from the \c GenericTypeOrExtensionScope. So we
702
- // / take the approach of doing those lookups there, and using this function
703
- // / to compute the selfDC from the history.
704
- static NullablePtr<DeclContext>
705
- computeSelfDC (ArrayRef<const ASTScopeImpl *> history);
706
-
707
- // / If we find a lookup result that requires the dynamic implict self value,
708
- // / we need to check the nested scopes to see if any closures explicitly
709
- // / captured \c self. In that case, the appropriate selfDC is that of the
710
- // / innermost closure which captures a \c self value from one of this type's
711
- // / methods.
712
- static NullablePtr<DeclContext>
713
- checkNestedScopesForSelfCapture (ArrayRef<const ASTScopeImpl *> history,
714
- size_t start);
715
684
};
716
685
717
686
// / Behavior specific to representing the trailing where clause of a
@@ -810,7 +779,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
810
779
virtual std::string declKindName () const = 0;
811
780
virtual bool doesDeclHaveABody () const ;
812
781
const char *portionName () const { return portion->portionName ; }
813
- Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const override ;
814
782
815
783
protected:
816
784
Optional<bool > resolveIsCascadingUseForThisScope (
@@ -1037,8 +1005,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {
1037
1005
1038
1006
NullablePtr<const void > getReferrent () const override ;
1039
1007
1040
- static bool shouldCreateAccessorScope (const AccessorDecl *);
1041
-
1042
1008
protected:
1043
1009
SourceRange
1044
1010
getSourceRangeOfEnclosedParamsOfASTNode (bool omitAssertions) const override ;
@@ -1115,7 +1081,6 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
1115
1081
}
1116
1082
virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
1117
1083
Decl *getDecl () const { return decl; }
1118
- static bool isAMethod (const AbstractFunctionDecl *);
1119
1084
1120
1085
NullablePtr<ASTScopeImpl> getParentOfASTAncestorScopesToBeRescued () override ;
1121
1086
@@ -1130,21 +1095,10 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
1130
1095
SourceRange sourceRangeForDeferredExpansion () const override ;
1131
1096
};
1132
1097
1133
- // / Body of methods, functions in types .
1134
- class MethodBodyScope final : public AbstractFunctionBodyScope {
1098
+ // / Body of functions and methods .
1099
+ class FunctionBodyScope final : public AbstractFunctionBodyScope {
1135
1100
public:
1136
- MethodBodyScope (AbstractFunctionDecl *e) : AbstractFunctionBodyScope(e) {}
1137
- std::string getClassName () const override ;
1138
- bool lookupLocalsOrMembers (ArrayRef<const ASTScopeImpl *>,
1139
- DeclConsumer consumer) const override ;
1140
-
1141
- Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const override ;
1142
- };
1143
-
1144
- // / Body of "pure" functions, functions without an implicit "self".
1145
- class PureFunctionBodyScope final : public AbstractFunctionBodyScope {
1146
- public:
1147
- PureFunctionBodyScope (AbstractFunctionDecl *e)
1101
+ FunctionBodyScope (AbstractFunctionDecl *e)
1148
1102
: AbstractFunctionBodyScope(e) {}
1149
1103
std::string getClassName () const override ;
1150
1104
bool lookupLocalsOrMembers (ArrayRef<const ASTScopeImpl *>,
@@ -1317,8 +1271,6 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
1317
1271
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1318
1272
virtual NullablePtr<DeclContext> getDeclContext () const override ;
1319
1273
1320
- Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const override ;
1321
-
1322
1274
protected:
1323
1275
bool lookupLocalsOrMembers (ArrayRef<const ASTScopeImpl *>,
1324
1276
DeclConsumer) const override ;
@@ -1430,13 +1382,6 @@ class ClosureParametersScope final : public ASTScopeImpl {
1430
1382
std::string getClassName () const override ;
1431
1383
SourceRange
1432
1384
getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
1433
-
1434
- // / Since explicit captures of \c self by closures enable the use of implicit
1435
- // / \c self, we need to make sure that the appropriate \c self is used as the
1436
- // / base decl for these uses (otherwise, the capture would be marked as
1437
- // / unused. \c ClosureParametersScope::capturedSelfDC() checks if we have such
1438
- // / a capture of self.
1439
- NullablePtr<DeclContext> capturedSelfDC () const override ;
1440
1385
1441
1386
NullablePtr<ClosureExpr> getClosureIfClosureScope () const override {
1442
1387
return closureExpr;
0 commit comments