@@ -141,22 +141,13 @@ class ASTScopeImpl {
141141 ASTScopeImpl *parent = nullptr ; // null at the root
142142
143143 // / Child scopes, sorted by source range.
144- // / Must clear source range change whenever this changes
145144 Children storedChildren;
146145
147146 bool wasExpanded = false ;
148147
149148 // / Can clear storedChildren, so must remember this
150149 bool haveAddedCleanup = false ;
151150
152- // Must be updated after last child is added and after last child's source
153- // position is known
154- mutable Optional<SourceRange> cachedSourceRange;
155-
156- // When ignoring ASTNodes in a scope, they still must count towards a scope's
157- // source range. So include their ranges here
158- SourceRange sourceRangeOfIgnoredASTNodes;
159-
160151 mutable Optional<CharSourceRange> cachedCharSourceRange;
161152
162153#pragma mark - constructor / destructor
@@ -194,9 +185,6 @@ class ASTScopeImpl {
194185public:
195186 void addChild (ASTScopeImpl *child, ASTContext &);
196187
197- private:
198- NullablePtr<ASTScopeImpl> getPriorSibling () const ;
199-
200188public:
201189 void preOrderDo (function_ref<void (ASTScopeImpl *)>);
202190 // / Like preorderDo but without myself.
@@ -205,67 +193,15 @@ class ASTScopeImpl {
205193
206194#pragma mark - source ranges
207195
208- #pragma mark - source range queries
209-
210196public:
211197 // / Return signum of ranges. Centralize the invariant that ASTScopes use ends.
212198 static int compare (SourceRange, SourceRange, const SourceManager &,
213199 bool ensureDisjoint);
214200
215- SourceRange getSourceRangeOfScope (bool omitAssertions = false ) const ;
216-
217201 CharSourceRange getCharSourceRangeOfScope (SourceManager &SM,
218202 bool omitAssertions = false ) const ;
219203 bool isCharSourceRangeCached () const ;
220204
221- // / InterpolatedStringLiteralExprs and EditorPlaceHolders respond to
222- // / getSourceRange with the starting point. But we might be asked to lookup an
223- // / identifer within one of them. So, find the real source range of them here.
224- SourceRange getEffectiveSourceRange (ASTNode) const ;
225-
226- void computeAndCacheSourceRangeOfScope (bool omitAssertions = false ) const ;
227- bool isSourceRangeCached (bool omitAssertions = false ) const ;
228-
229- bool checkSourceRangeOfThisASTNode () const ;
230-
231- // / For debugging
232- bool doesRangeMatch (unsigned start, unsigned end, StringRef file = " " ,
233- StringRef className = " " );
234-
235- unsigned countDescendants () const ;
236-
237- // / Make sure that when the argument is executed, there are as many
238- // / descendants after as before.
239- void assertThatTreeDoesNotShrink (function_ref<void ()>);
240-
241- private:
242- SourceRange computeSourceRangeOfScope (bool omitAssertions = false ) const ;
243- SourceRange
244- computeSourceRangeOfScopeWithChildASTNodes (bool omitAssertions = false ) const ;
245- bool ensureNoAncestorsSourceRangeIsCached () const ;
246-
247- #pragma mark - source range adjustments
248- private:
249- SourceRange widenSourceRangeForIgnoredASTNodes (SourceRange range) const ;
250-
251- // / If the scope refers to a Decl whose source range tells the whole story,
252- // / for example a NominalTypeScope, it is not necessary to widen the source
253- // / range by examining the children. In that case we could just return
254- // / the childlessRange here.
255- // / But, we have not marked such scopes yet. Doing so would be an
256- // / optimization.
257- SourceRange widenSourceRangeForChildren (SourceRange range,
258- bool omitAssertions) const ;
259-
260- // / Even ASTNodes that do not form scopes must be included in a Scope's source
261- // / range. Widen the source range of the receiver to include the (ignored)
262- // / node.
263- void widenSourceRangeForIgnoredASTNode (ASTNode);
264-
265- private:
266- void clearCachedSourceRangesOfMeAndAncestors ();
267-
268- public: // public for debugging
269205 // / Returns source range of this node alone, without factoring in any
270206 // / children.
271207 virtual SourceRange
@@ -331,19 +267,11 @@ class ASTScopeImpl {
331267 void setWasExpanded () { wasExpanded = true ; }
332268 virtual ASTScopeImpl *expandSpecifically (ScopeCreator &) = 0;
333269
334- private:
335- // / Compare the pre-expasion range with the post-expansion range and return
336- // / false if lazyiness couild miss lookups.
337- bool checkLazySourceRange (const ASTContext &) const ;
338-
339270public:
340271 // / Some scopes can be expanded lazily.
341- // / Such scopes must: not change their source ranges after expansion, and
342- // / their expansion must return an insertion point outside themselves.
343- // / After a node is expanded, its source range (getSourceRangeofThisASTNode
344- // / union children's ranges) must be same as this.
272+ // / Such scopes must return an insertion point outside themselves when
273+ // / expanded.
345274 virtual NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion ();
346- virtual SourceRange sourceRangeForDeferredExpansion () const ;
347275
348276private:
349277 virtual ScopeCreator &getScopeCreator ();
@@ -547,8 +475,6 @@ class Portion {
547475
548476 virtual NullablePtr<ASTScopeImpl>
549477 insertionPointForDeferredExpansion (IterableTypeScope *) const = 0 ;
550- virtual SourceRange
551- sourceRangeForDeferredExpansion (const IterableTypeScope *) const = 0 ;
552478 };
553479
554480 // For the whole Decl scope of a GenericType or an Extension
@@ -572,8 +498,6 @@ class Portion {
572498
573499 NullablePtr<ASTScopeImpl>
574500 insertionPointForDeferredExpansion (IterableTypeScope *) const override ;
575- SourceRange
576- sourceRangeForDeferredExpansion (const IterableTypeScope *) const override ;
577501 };
578502
579503 // / GenericTypeOrExtension = GenericType or Extension
@@ -605,8 +529,6 @@ class GenericTypeOrExtensionWherePortion final
605529
606530 NullablePtr<ASTScopeImpl>
607531 insertionPointForDeferredExpansion (IterableTypeScope *) const override ;
608- SourceRange
609- sourceRangeForDeferredExpansion (const IterableTypeScope *) const override ;
610532};
611533
612534// / Behavior specific to representing the Body of a NominalTypeDecl or
@@ -624,8 +546,6 @@ class IterableTypeBodyPortion final
624546
625547 NullablePtr<ASTScopeImpl>
626548 insertionPointForDeferredExpansion (IterableTypeScope *) const override ;
627- SourceRange
628- sourceRangeForDeferredExpansion (const IterableTypeScope *) const override ;
629549};
630550
631551// / GenericType or Extension scope
@@ -722,7 +642,6 @@ class IterableTypeScope : public GenericTypeScope {
722642
723643public:
724644 NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion () override ;
725- SourceRange sourceRangeForDeferredExpansion () const override ;
726645
727646 void countBodies (ScopeCreator &) const ;
728647};
@@ -931,7 +850,6 @@ class FunctionBodyScope : public ASTScopeImpl {
931850public:
932851 std::string getClassName () const override ;
933852 NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion () override ;
934- SourceRange sourceRangeForDeferredExpansion () const override ;
935853};
936854
937855class DefaultArgumentInitializerScope final : public ASTScopeImpl {
0 commit comments