@@ -3,29 +3,28 @@ import go
33import qtil.go.graph.CustomPathStateProblem
44
55module CallGraphPathStateProblemConfig implements CustomPathStateProblemConfigSig {
6- class Node = Variable ;
6+ class Node = Ident ;
77
88 class State = int ; // Track search depth
99
1010 predicate start ( Node n , int depth ) { n .getName ( ) = "start" and depth = 0 }
1111
1212 bindingset [ depth]
13- predicate end ( Node n , int depth ) { n .getName ( ) = "end" }
13+ predicate end ( Node n , int depth ) { n .getName ( ) = "end" and depth >= 0 }
1414
1515 bindingset [ depth1]
1616 bindingset [ depth2]
17- predicate edge ( Variable a , int depth1 , Variable b , int depth2 ) {
17+ predicate edge ( Ident a , int depth1 , Ident b , int depth2 ) {
1818 depth2 = depth1 + 1 and
19- exists ( ValueSpec specA , ValueSpec specB |
20- specA .getNameExpr ( 0 ) .( Ident ) .getName ( ) = a .getName ( ) and
21- specB .getNameExpr ( 0 ) .( Ident ) .getName ( ) = b .getName ( ) and
22- specA .getValue ( 0 ) .( Ident ) .getName ( ) = b .getName ( )
19+ exists ( Assignment assign |
20+ assign .getLhs ( ) .( Name ) .getTarget ( ) .getDeclaration ( ) = a and
21+ assign .getRhs ( ) .( Name ) .getTarget ( ) .getDeclaration ( ) = b
2322 )
2423 }
2524}
2625
2726import CustomPathStateProblem< CallGraphPathStateProblemConfig >
2827
29- from Variable start , Variable end
28+ from Ident start , Ident end
3029where problem ( start , end )
3130select start , end , "Path from $@ to $@." , start .getName ( ) , start , end .getName ( ) , end
0 commit comments