@@ -78,6 +78,24 @@ private ItemNode getAChildSuccessor(ItemNode item, string name, SuccessorKind ki
7878 )
7979}
8080
81+ /**
82+ * Holds if `n` is superceded by an attribute macro expansion. That is, `n` is
83+ * an item or a transitive child of an item with an attribute macro expansion.
84+ */
85+ predicate supercededByAttributeMacroExpansion ( AstNode n ) {
86+ n .( Item ) .hasAttributeMacroExpansion ( )
87+ or
88+ exists ( AstNode parent |
89+ n .getParentNode ( ) = parent and
90+ supercededByAttributeMacroExpansion ( parent ) and
91+ // Don't exclude expansions themselves as they supercede other nodes.
92+ not n = parent .( Item ) .getAttributeMacroExpansion ( ) and
93+ // Don't consider attributes themselves to be superceded. E.g., in `#[a] fn
94+ // f() {}` the macro expansion supercedes `fn f() {}` but not `#[a]`.
95+ not n instanceof Attr
96+ )
97+ }
98+
8199/**
82100 * An item that may be referred to by a path, and which is a node in
83101 * the _item graph_.
@@ -158,7 +176,7 @@ private ItemNode getAChildSuccessor(ItemNode item, string name, SuccessorKind ki
158176abstract class ItemNode extends Locatable {
159177 ItemNode ( ) {
160178 // Exclude items that are superceded by the expansion of an attribute macro.
161- not this . ( Item ) . hasAttributeMacroExpansion ( )
179+ not supercededByAttributeMacroExpansion ( this )
162180 }
163181
164182 /** Gets the (original) name of this item. */
@@ -1773,6 +1791,8 @@ private module Debug {
17731791 path = p .toStringDebug ( )
17741792 }
17751793
1794+ predicate debugItemNode ( ItemNode item ) { item = getRelevantLocatable ( ) }
1795+
17761796 ItemNode debugResolvePath ( RelevantPath path ) {
17771797 path = getRelevantLocatable ( ) and
17781798 result = resolvePath ( path )
0 commit comments