Skip to content

Commit a8a316f

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

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 |
@@ -680,32 +674,6 @@ private class ImplTraitTypeReprItemNode extends ItemNode instanceof ImplTraitTyp
680674
override string getCanonicalPath(Crate c) { none() }
681675
}
682676

683-
private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
684-
override string getName() { result = "(macro call)" }
685-
686-
override predicate hasImplementation() { none() }
687-
688-
override Namespace getNamespace() { none() }
689-
690-
override TypeParam getTypeParam(int i) { none() }
691-
692-
override Visibility getVisibility() { none() }
693-
694-
override predicate providesCanonicalPathPrefixFor(Crate c, ItemNode child) {
695-
any(ItemNode parent).providesCanonicalPathPrefixFor(c, this) and
696-
child.getImmediateParent() = this
697-
}
698-
699-
override string getCanonicalPathPrefixFor(Crate c, ItemNode child) {
700-
result = this.getCanonicalPathPrefix(c) and
701-
this.providesCanonicalPathPrefixFor(c, child)
702-
}
703-
704-
override predicate hasCanonicalPath(Crate c) { none() }
705-
706-
override string getCanonicalPath(Crate c) { none() }
707-
}
708-
709677
private class ModuleItemNode extends ModuleLikeNode instanceof Module {
710678
override string getName() { result = Module.super.getName().getText() }
711679

@@ -726,11 +694,6 @@ private class ModuleItemNode extends ModuleLikeNode instanceof Module {
726694
)
727695
or
728696
this = child.getImmediateParent()
729-
or
730-
exists(ItemNode mid |
731-
this.providesCanonicalPathPrefixFor(c, mid) and
732-
mid.(MacroCallItemNode) = child.getImmediateParent()
733-
)
734697
)
735698
}
736699

@@ -1186,11 +1149,6 @@ private predicate declares(ItemNode item, Namespace ns, string name) {
11861149
useTreeDeclares(child.(Use).getUseTree(), name) and
11871150
exists(ns) // `use foo::bar` can refer to both a value and a type
11881151
)
1189-
or
1190-
exists(MacroCallItemNode call |
1191-
declares(call, ns, name) and
1192-
call.getImmediateParent() = item
1193-
)
11941152
}
11951153

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

0 commit comments

Comments
 (0)