Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds line number to tracing tag of python functions to make them unique #39

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lobster/tools/python/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def fqn(self):
rv = self.parent.fqn() + "."
else:
rv = ""
rv += self.name
if self.location.line is not None and \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider the following refactoring:

  1. Call self.fqn once before creating Implementation, see
    l_item = Implementation(tag = Tracing_Tag("python",
  2. Find a unique name by iterating over items
  3. Don't use the line number, because this ID will be dynamic and changes if someone adds new lines to the file. Instead, use some kind of counter.

The first tag name shall always be without a number. Only the second tag name shall add a suffix.

isinstance(self, Python_Function):
rv += f"{self.name}:{str(self.location.line)}"
else:
rv += self.name
return rv

def lobster_tag(self):
Expand Down
Loading