Skip to content

Commit ed2b460

Browse files
author
Farhaan Bukhsh
committed
Add condition to check for super calls and this calls
This commit adds the method to check and avoid super and this calls, since they can't be used to form edges. Signed-off-by: Farhaan Bukhsh <[email protected]>
1 parent c19d6c1 commit ed2b460

File tree

1 file changed

+6
-4
lines changed
  • persper/analytics/call_graph/java

1 file changed

+6
-4
lines changed

persper/analytics/call_graph/java/java2.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ def enterMethodDeclaration(self, ctx=JavaParser.MethodDeclarationContext):
7070

7171
def enterMethodCall(self, ctx: JavaParser.MethodCallContext):
7272
try:
73-
name = ctx.IDENTIFIER().getText()
74-
if self.current_function_name:
75-
self.function_caller_callee_map[self.current_function_name].append(
76-
name)
73+
# The condition is there to avoid functions like `this()` or `super()`
74+
if ctx.IDENTIFIER():
75+
name = ctx.IDENTIFIER().getText()
76+
if self.current_function_name:
77+
self.function_caller_callee_map[self.current_function_name].append(
78+
name)
7779
except Exception as e:
7880
if DEBUG:
7981
raise

0 commit comments

Comments
 (0)