From c0652f148e6bcd1230fa55be5d04677fc8f55f9c Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Wed, 18 Jun 2025 16:56:24 +0200
Subject: [PATCH] Small update for the detection of emits -> check that the
 emited value is not an operation

---
 src/operation.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/operation.py b/src/operation.py
index d8933aa..e8df4a1 100644
--- a/src/operation.py
+++ b/src/operation.py
@@ -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
-- 
GitLab