@@ -229,18 +229,13 @@ class ScopeCreator final {
229
229
ArrayRef<ASTNode> nodesOrDeclsToAdd) {
230
230
auto *ip = insertionPoint;
231
231
for (auto nd : sortBySourceRange (cull (nodesOrDeclsToAdd))) {
232
- if (!shouldThisNodeBeScopedWhenFoundInSourceFileBraceStmtOrType (nd)) {
233
- // FIXME: Could the range get lost if the node is ever reexpanded?
234
- ip->widenSourceRangeForIgnoredASTNode (nd);
235
- } else {
236
- const unsigned preCount = ip->getChildren ().size ();
237
- auto *const newIP =
238
- addToScopeTreeAndReturnInsertionPoint (nd, ip).getPtrOr (ip);
239
- if (ip != organicInsertionPoint)
240
- ip->increaseASTAncestorScopeCount (ip->getChildren ().size () -
241
- preCount);
242
- ip = newIP;
243
- }
232
+ const unsigned preCount = ip->getChildren ().size ();
233
+ auto *const newIP =
234
+ addToScopeTreeAndReturnInsertionPoint (nd, ip).getPtrOr (ip);
235
+ if (ip != organicInsertionPoint)
236
+ ip->increaseASTAncestorScopeCount (ip->getChildren ().size () -
237
+ preCount);
238
+ ip = newIP;
244
239
}
245
240
return ip;
246
241
}
@@ -537,32 +532,6 @@ class ScopeCreator final {
537
532
return -1 == signum;
538
533
}
539
534
540
- static bool isVarDeclInPatternBindingDecl (ASTNode n1, ASTNode n2) {
541
- if (auto *d1 = n1.dyn_cast <Decl *>())
542
- if (auto *vd = dyn_cast<VarDecl>(d1))
543
- if (auto *d2 = n2.dyn_cast <Decl *>())
544
- if (auto *pbd = dyn_cast<PatternBindingDecl>(d2))
545
- return vd->getParentPatternBinding () == pbd;
546
- return false ;
547
- }
548
-
549
- public:
550
- bool shouldThisNodeBeScopedWhenFoundInSourceFileBraceStmtOrType (ASTNode n) {
551
- // Do not scope VarDecls because
552
- // they get created directly by the pattern code.
553
- // Doing otherwise distorts the source range
554
- // of their parents.
555
- ASTScopeAssert (!n.isDecl (DeclKind::Accessor),
556
- " Should not see accessors here" );
557
- // Can occur in illegal code
558
- // non-empty brace stmt could define a new insertion point
559
- if (auto *const s = n.dyn_cast <Stmt *>()) {
560
- if (auto *const bs = dyn_cast<BraceStmt>(s))
561
- return !bs->empty ();
562
- }
563
- return !n.isDecl (DeclKind::Var);
564
- }
565
-
566
535
public:
567
536
// / For debugging. Return true if scope tree contains all the decl contexts in
568
537
// / the AST May modify the scope tree in order to update obsolete scopes.
0 commit comments