@@ -474,16 +474,6 @@ class ASTScopeImpl {
474474 NullablePtr<const GenericParamList> lastListSearched,
475475 DeclConsumer consumer) const ;
476476
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-
487477protected:
488478 // / Find either locals or members (no scope has both)
489479 // / \param history The scopes visited since the start of lookup (including
@@ -691,27 +681,6 @@ class Portion {
691681 bool lookupMembersOf (const GenericTypeOrExtensionScope *scope,
692682 ArrayRef<const ASTScopeImpl *>,
693683 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);
715684};
716685
717686// / Behavior specific to representing the trailing where clause of a
@@ -810,7 +779,6 @@ class GenericTypeOrExtensionScope : public ASTScopeImpl {
810779 virtual std::string declKindName () const = 0;
811780 virtual bool doesDeclHaveABody () const ;
812781 const char *portionName () const { return portion->portionName ; }
813- Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const override ;
814782
815783protected:
816784 Optional<bool > resolveIsCascadingUseForThisScope (
@@ -1037,8 +1005,6 @@ class AbstractFunctionDeclScope final : public ASTScopeImpl {
10371005
10381006 NullablePtr<const void > getReferrent () const override ;
10391007
1040- static bool shouldCreateAccessorScope (const AccessorDecl *);
1041-
10421008protected:
10431009 SourceRange
10441010 getSourceRangeOfEnclosedParamsOfASTNode (bool omitAssertions) const override ;
@@ -1115,7 +1081,6 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
11151081 }
11161082 virtual NullablePtr<Decl> getDeclIfAny () const override { return decl; }
11171083 Decl *getDecl () const { return decl; }
1118- static bool isAMethod (const AbstractFunctionDecl *);
11191084
11201085 NullablePtr<ASTScopeImpl> getParentOfASTAncestorScopesToBeRescued () override ;
11211086
@@ -1130,21 +1095,10 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
11301095 SourceRange sourceRangeForDeferredExpansion () const override ;
11311096};
11321097
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 {
11351100public:
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)
11481102 : AbstractFunctionBodyScope(e) {}
11491103 std::string getClassName () const override ;
11501104 bool lookupLocalsOrMembers (ArrayRef<const ASTScopeImpl *>,
@@ -1317,8 +1271,6 @@ class PatternEntryInitializerScope final : public AbstractPatternEntryScope {
13171271 getSourceRangeOfThisASTNode (bool omitAssertions = false ) const override ;
13181272 virtual NullablePtr<DeclContext> getDeclContext () const override ;
13191273
1320- Optional<NullablePtr<DeclContext>> computeSelfDCForParent () const override ;
1321-
13221274protected:
13231275 bool lookupLocalsOrMembers (ArrayRef<const ASTScopeImpl *>,
13241276 DeclConsumer) const override ;
@@ -1430,13 +1382,6 @@ class ClosureParametersScope final : public ASTScopeImpl {
14301382 std::string getClassName () const override ;
14311383 SourceRange
14321384 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 ;
14401385
14411386 NullablePtr<ClosureExpr> getClosureIfClosureScope () const override {
14421387 return closureExpr;
0 commit comments