@@ -388,20 +388,6 @@ class TypeRefinementContextBuilder : private ASTWalker {
388
388
};
389
389
std::vector<DeclBodyContextInfo> DeclBodyContextStack;
390
390
391
- // / A mapping from abstract storage declarations with accessors to
392
- // / to the type refinement contexts for those declarations. We refer to
393
- // / this map to determine the appropriate parent TRC to use when
394
- // / walking the accessor function.
395
- llvm::DenseMap<AbstractStorageDecl *, TypeRefinementContext *>
396
- StorageContexts;
397
-
398
- // / A mapping from pattern binding storage declarations to the type refinement
399
- // / contexts for those declarations. We refer to this map to determine the
400
- // / appropriate parent TRC to use when walking a var decl that belongs to a
401
- // / pattern containing multiple vars.
402
- llvm::DenseMap<PatternBindingDecl *, TypeRefinementContext *>
403
- PatternBindingContexts;
404
-
405
391
TypeRefinementContext *getCurrentTRC () {
406
392
return ContextStack.back ().TRC ;
407
393
}
@@ -482,19 +468,9 @@ class TypeRefinementContextBuilder : private ASTWalker {
482
468
PreWalkAction walkToDeclPre (Decl *D) override {
483
469
PrettyStackTraceDecl trace (stackTraceAction (), D);
484
470
485
- // Adds in a parent TRC for decls which are syntactically nested but are not
486
- // represented that way in the AST. (Particularly, AbstractStorageDecl
487
- // parents for AccessorDecl children.)
488
- if (auto ParentTRC = getEffectiveParentContextForDecl (D)) {
489
- pushContext (ParentTRC, D);
490
- }
491
-
492
471
// Adds in a TRC that covers the entire declaration.
493
472
if (auto DeclTRC = getNewContextForSignatureOfDecl (D)) {
494
473
pushContext (DeclTRC, D);
495
-
496
- // Possibly use this as an effective parent context later.
497
- recordEffectiveParentContext (D, DeclTRC);
498
474
}
499
475
500
476
// Create TRCs that cover only the body of the declaration.
@@ -515,49 +491,6 @@ class TypeRefinementContextBuilder : private ASTWalker {
515
491
return Action::Continue ();
516
492
}
517
493
518
- TypeRefinementContext *getEffectiveParentContextForDecl (Decl *D) {
519
- // FIXME: Can we assert that we won't walk parent decls later that should
520
- // have been returned here?
521
- if (auto *accessor = dyn_cast<AccessorDecl>(D)) {
522
- // Use TRC of the storage rather the current TRC when walking this
523
- // function.
524
- auto it = StorageContexts.find (accessor->getStorage ());
525
- if (it != StorageContexts.end ()) {
526
- return it->second ;
527
- }
528
- } else if (auto *VD = dyn_cast<VarDecl>(D)) {
529
- // Use the TRC of the pattern binding decl as the parent for var decls.
530
- if (auto *PBD = VD->getParentPatternBinding ()) {
531
- auto it = PatternBindingContexts.find (PBD);
532
- if (it != PatternBindingContexts.end ()) {
533
- return it->second ;
534
- }
535
- }
536
- }
537
-
538
- return nullptr ;
539
- }
540
-
541
- // / If necessary, records a TRC so it can be returned by subsequent calls to
542
- // / `getEffectiveParentContextForDecl()`.
543
- void recordEffectiveParentContext (Decl *D, TypeRefinementContext *NewTRC) {
544
- if (auto *StorageDecl = dyn_cast<AbstractStorageDecl>(D)) {
545
- // Stash the TRC for the storage declaration to use as the parent of
546
- // accessor decls later.
547
- if (StorageDecl->hasParsedAccessors ())
548
- StorageContexts[StorageDecl] = NewTRC;
549
- }
550
-
551
- if (auto *VD = dyn_cast<VarDecl>(D)) {
552
- // Stash the TRC for the var decl if its parent pattern binding decl has
553
- // more than one entry so that the sibling var decls can reuse it.
554
- if (auto *PBD = VD->getParentPatternBinding ()) {
555
- if (PBD->getNumPatternEntries () > 1 )
556
- PatternBindingContexts[PBD] = NewTRC;
557
- }
558
- }
559
- }
560
-
561
494
// / Returns a new context to be introduced for the declaration, or nullptr
562
495
// / if no new context should be introduced.
563
496
TypeRefinementContext *getNewContextForSignatureOfDecl (Decl *D) {
0 commit comments