Skip to content

Commit 9966a74

Browse files
authored
Add POST_EXECUTION_CALL node for library modeling. (#991)
A POST_EXECUTION_CALL node indicates the existence of a call executed on a return value or out parameter of a method after this method has been executed. This is used to model framework code calling functors returned from user code. The outgoing REF edge indicates on which returned entitity the call will happen.
1 parent 6cc339e commit 9966a74

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

codepropertygraph/src/main/resources/schemas/enhancements-internal.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,10 @@
622622
{
623623
"name": "IMPLICIT_CALL", "keys" : ["DEPTH_FIRST_ORDER", "INTERNAL_FLAGS"]
624624
},
625-
{
625+
{
626+
"name": "POST_EXECUTION_CALL", "keys" : ["DEPTH_FIRST_ORDER", "INTERNAL_FLAGS"]
627+
},
628+
{
626629
"name": "ANNOTATION_LITERAL", "keys" : ["DEPTH_FIRST_ORDER", "INTERNAL_FLAGS"]
627630
},
628631
{

codepropertygraph/src/main/resources/schemas/enhancements.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@
2020
"is": ["CALL_REPR", "TRACKING_POINT"],
2121
"outEdges" : []
2222
},
23+
{
24+
"id":3071,"name" : "POST_EXECUTION_CALL",
25+
"keys" : ["CODE", "NAME", "SIGNATURE", "LINE_NUMBER", "COLUMN_NUMBER", "ORDER"],
26+
"comment" : "Indicates the existence of a call executed on a return value or out parameter of a method after this method has been executed. This is used to model framework code calling functors returned from user code. The outgoing REF edge indicates on which returned entitity the call will happen.",
27+
"is": ["CALL_REPR", "TRACKING_POINT"],
28+
"outEdges" : [
29+
{"edgeName": "REF", "inNodes": [{"name": "METHOD_RETURN"}, {"name": "METHOD_PARAMETER_OUT"}]}
30+
]
31+
},
2332

24-
{"id":24, "name": "TAG",
33+
{"id":24, "name": "TAG",
2534
"keys": ["NAME", "VALUE"],
2635
"comment": "A string tag",
2736
"outEdges": []
@@ -49,7 +58,8 @@
4958
{"name": "TYPE_DECL", "cardinality": "0-1:n"},
5059
{"name": "METHOD", "cardinality": "0-1:n"},
5160
{"name": "METHOD_PARAMETER_OUT"},
52-
{"name": "IMPLICIT_CALL"}
61+
{"name": "IMPLICIT_CALL"},
62+
{"name": "POST_EXECUTION_CALL"}
5363
]},
5464
{"edgeName": "REACHING_DEF", "inNodes": [
5565
{"name": "CALL"},

semanticcpg/src/main/scala/io/shiftleft/semanticcpg/language/nodemethods/WithinMethodMethods.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class WithinMethodMethods(val node: nodes.WithinMethod) extends AnyVal {
1212
case node: nodes.MethodParameterOut => walkUpAst(node)
1313
case node: nodes.MethodReturn => walkUpAst(node)
1414
case node: nodes.ImplicitCall => walkUpAst(node)
15+
case node: nodes.PostExecutionCall => walkUpAst(node)
1516
case node: nodes.Expression => expressionToMethod(node)
1617
}
1718

0 commit comments

Comments
 (0)