semantic: display Types in context pretty-printing

This commit is contained in:
Antoine Viallon 2023-05-23 23:12:28 +02:00
parent 20731d969e
commit 5252f772ed
Signed by: aviallon
GPG key ID: D126B13AB555E16F

View file

@ -28,7 +28,7 @@ class SymbolABC(abc.ABC):
if self._repr_guard:
return str(self)
self._repr_guard = True
definitions = [str(d.location().begin) for d in self.definitions if d is not None]
definitions = [str(d.location().begin) for d in self.writes if isinstance(d, nodes.Node)]
self._repr_guard = False
return f"{str(self)} [definitions: {', '.join(definitions)}]"
@ -136,6 +136,10 @@ class Context:
result = [str(self)]
if self.parent is not None:
result += [f"\tParent ID: {self.parent.name}"]
if len(self.types) > 0:
result += [f"\tTypes ({len(self.types)}):"]
for key, value in self.types.items():
result += [f"\t\t- {repr(value)}"]
if len(self.variables) > 0:
result += [f"\tVariables ({len(self.variables)}):"]
for key, value in self.variables.items():