Skip to content

Commit a834f35

Browse files
committed
Rust: remove MacroCallItemNode
Macro calls are not really items, so they can just be skipped
1 parent da924ef commit a834f35

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

rust/ql/lib/codeql/rust/internal/PathResolution.qll

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ abstract class ItemNode extends Locatable {
147147
)
148148
)
149149
or
150-
// items made available through macro calls are available to nodes that contain the macro call
151-
exists(MacroCallItemNode call |
152-
call = this.getASuccessorRec(_) and
153-
result = call.(ItemNode).getASuccessorRec(name)
154-
)
155-
or
156150
// a trait has access to the associated items of its supertraits
157151
this =
158152
any(TraitItemNode trait |
@@ -673,32 +667,6 @@ private class ImplTraitTypeReprItemNode extends ItemNode instanceof ImplTraitTyp
673667
override string getCanonicalPath(Crate c) { none() }
674668
}
675669

676-
private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
677-
override string getName() { result = "(macro call)" }
678-
679-
override predicate hasImplementation() { none() }
680-
681-
override Namespace getNamespace() { none() }
682-
683-
override TypeParam getTypeParam(int i) { none() }
684-
685-
override Visibility getVisibility() { none() }
686-
687-
override predicate providesCanonicalPathPrefixFor(Crate c, ItemNode child) {
688-
any(ItemNode parent).providesCanonicalPathPrefixFor(c, this) and
689-
child.getImmediateParent() = this
690-
}
691-
692-
override string getCanonicalPathPrefixFor(Crate c, ItemNode child) {
693-
result = this.getCanonicalPathPrefix(c) and
694-
this.providesCanonicalPathPrefixFor(c, child)
695-
}
696-
697-
override predicate hasCanonicalPath(Crate c) { none() }
698-
699-
override string getCanonicalPath(Crate c) { none() }
700-
}
701-
702670
private class ModuleItemNode extends ModuleLikeNode instanceof Module {
703671
override string getName() { result = Module.super.getName().getText() }
704672

@@ -719,11 +687,6 @@ private class ModuleItemNode extends ModuleLikeNode instanceof Module {
719687
)
720688
or
721689
this = child.getImmediateParent()
722-
or
723-
exists(ItemNode mid |
724-
this.providesCanonicalPathPrefixFor(c, mid) and
725-
mid.(MacroCallItemNode) = child.getImmediateParent()
726-
)
727690
)
728691
}
729692

@@ -1176,11 +1139,6 @@ private predicate declares(ItemNode item, Namespace ns, string name) {
11761139
useTreeDeclares(child.(Use).getUseTree(), name) and
11771140
exists(ns) // `use foo::bar` can refer to both a value and a type
11781141
)
1179-
or
1180-
exists(MacroCallItemNode call |
1181-
declares(call, ns, name) and
1182-
call.getImmediateParent() = item
1183-
)
11841142
}
11851143

11861144
/** A path that does not access a local variable. */

0 commit comments

Comments
 (0)