File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ // script
2+ use coref::java::*
3+
4+ pub fn default_java_db() -> JavaDB {
5+ return JavaDB::load("coref_java_src.db")
6+ }
7+
8+ pub fn specified_callable_signature(name: string) -> bool {
9+ // give specified callables' signatures here
10+ [
11+ {"com.alipay.demo.Main.test:void()"},
12+ {"xxx"},
13+ {"xxx"}
14+ ]
15+ }
16+
17+ schema SpecifiedCallable extends Callable {}
18+
19+ impl SpecifiedCallable {
20+ @data_constraint
21+ pub fn __all__(db: JavaDB) -> *Self {
22+ for(c in Callable(db)) {
23+ if (specified_callable_signature(c.getSignature())) {
24+ yield SpecifiedCallable { id: c.id }
25+ }
26+ }
27+ }
28+ }
29+
30+ pub fn getIndirectEdges(b: Callable, c: Callable) -> bool {
31+ for(a in SpecifiedCallable(default_java_db())) {
32+ if (b in a.getAnAncestorCallee() && c in b.getCallee()) {
33+ return true
34+ }
35+ }
36+ }
37+
38+ pub fn getDirectEdges(b: Callable, c: Callable) -> bool {
39+ for(a in SpecifiedCallable(default_java_db())) {
40+ if (c in a.getCallee() && b.key_eq(a)) {
41+ return true
42+ }
43+ }
44+ }
45+
46+ pub fn output_signature(caller: string, callee: string) -> bool {
47+ for(b in Callable(default_java_db()), c in Callable(default_java_db())) {
48+ if (getIndirectEdges(b, c) || getDirectEdges(b, c)) {
49+ return caller = b.getSignature() && callee = c.getSignature()
50+ }
51+ }
52+ }
53+
54+ pub fn main() {
55+ output(output_signature())
56+ }
You can’t perform that action at this time.
0 commit comments