Skip to content
Snippets Groups Projects
Commit c0652f14 authored by George Marchment's avatar George Marchment
Browse files

Small update for the detection of emits -> check that the emited value is not an operation

parent 4f9a2a58
No related branches found
No related tags found
No related merge requests found
Pipeline #14730 failed with stage
in 3 minutes and 10 seconds
......@@ -184,6 +184,7 @@ class Operation(Executor):
if(calls!=[]):
for call in calls:
#print(full_code, self.get_code(get_OG=True))
emitted = Emitted(name=full_code, origin=self.origin, emitted_by=call)
emitted.set_emits(name_emitted)
emitted.add_sink(self)
......@@ -364,8 +365,16 @@ class Operation(Executor):
if(name_emitted==""):
self.add_origin_emits(full_code, name_called, "")
if(name_emitted in constant.LIST_OPERATORS):
full_code = '.'.join(full_code.split(".")[:-1])
self.add_origin_emits(full_code, name_called, "")
pos = self.get_code().find(full_code)
#This basically checks if the name_emitted is an operation or not
if(pos+len(full_code)>=len(self.get_code())
or self.get_code()[pos+len(full_code):].strip()[0] not in ["(", "{"]):
#Case not an operation
self.add_origin_emits(full_code, name_called, name_emitted)
else:
#Case Operation
full_code = '.'.join(full_code.split(".")[:-1])
self.add_origin_emits(full_code, name_called, "")
else:
self.add_origin_emits(full_code, name_called, name_emitted)
temp = operation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment