File tree Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,6 @@ class ASTScopeImpl : public ASTAllocated<ASTScopeImpl> {
237237 NullablePtr<Decl> getDeclIfAny () const ;
238238 NullablePtr<Stmt> getStmtIfAny () const ;
239239 NullablePtr<Expr> getExprIfAny () const ;
240- NullablePtr<DeclAttribute> getDeclAttributeIfAny () const ;
241240
242241#pragma mark - debugging and printing
243242
Original file line number Diff line number Diff line change @@ -170,22 +170,6 @@ NullablePtr<Expr> ASTScopeImpl::getExprIfAny() const {
170170 }
171171}
172172
173- NullablePtr<DeclAttribute> ASTScopeImpl::getDeclAttributeIfAny () const {
174- switch (getKind ()) {
175- // Statement scope nodes extract the statement directly.
176- #define DECL_ATTRIBUTE_SCOPE_NODE (Name ) \
177- case ScopeKind::Name: return cast<Name##Scope>(this )->getDeclAttr ();
178- #define SCOPE_NODE (Name )
179- #include " swift/AST/ASTScopeNodes.def"
180-
181- // Everything else returns nullptr.
182- #define DECL_ATTRIBUTE_SCOPE_NODE (Name )
183- #define SCOPE_NODE (Name ) case ScopeKind::Name:
184- #include " swift/AST/ASTScopeNodes.def"
185- return nullptr ;
186- }
187- }
188-
189173SourceManager &ASTScopeImpl::getSourceManager () const {
190174 return getASTContext ().SourceMgr ;
191175}
Original file line number Diff line number Diff line change @@ -649,10 +649,10 @@ void ASTScopeImpl::lookupEnclosingMacroScope(
649649 return ;
650650 }
651651
652- auto *attr = scope-> getDeclAttributeIfAny (). getPtrOrNull ();
653- auto *potentialAttached = dyn_cast_or_null<CustomAttr>( attr);
654- if (potentialAttached && consume (potentialAttached))
655- return ;
652+ if ( auto customAttrScope = dyn_cast<CustomAttributeScope>(scope)) {
653+ if ( consume (customAttrScope-> attr ))
654+ return ;
655+ }
656656
657657 // If we've reached a source file scope, we can't be inside of
658658 // a macro argument. Either this is a top-level source file, or
You can’t perform that action at this time.
0 commit comments