mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #19028 from hvitved/rust/crate-locatable
This commit is contained in:
@@ -101,14 +101,16 @@
|
||||
#-----| -> Crate(getopts@0.2.21)
|
||||
#-----| -> Crate(libc@0.2.169)
|
||||
|
||||
#-----| Crate(test@0.0.1)
|
||||
lib.rs:
|
||||
# 0| Crate(test@0.0.1)
|
||||
#-----| -> Crate(core@0.0.0)
|
||||
#-----| -> Crate(std@0.0.0)
|
||||
#-----| -> Crate(alloc@0.0.0)
|
||||
#-----| -> Crate(proc_macro@0.0.0)
|
||||
#-----| -> Crate(test@0.0.0)
|
||||
|
||||
#-----| Crate(main@0.0.1)
|
||||
main.rs:
|
||||
# 0| Crate(main@0.0.1)
|
||||
#-----| -> Crate(core@0.0.0)
|
||||
#-----| -> Crate(std@0.0.0)
|
||||
#-----| -> Crate(alloc@0.0.0)
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
|
||||
import rust
|
||||
|
||||
query predicate nodes(Crate c) { any() }
|
||||
class MyCrate extends Crate {
|
||||
// avoid printing locations for crates outside of the test folder
|
||||
Location getLocation() { result = super.getLocation() and this.fromSource() }
|
||||
}
|
||||
|
||||
query predicate edges(Crate c1, Crate c2) { c1.getADependency() = c2 }
|
||||
query predicate nodes(MyCrate c) { any() }
|
||||
|
||||
query predicate edges(MyCrate c1, MyCrate c2) { c1.getADependency() = c2 }
|
||||
|
||||
Reference in New Issue
Block a user