Skip to content

Commit 02b0e1a

Browse files
committed
Formatting
1 parent 45f0e82 commit 02b0e1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

semantic_listener.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ def enterSimpleAssignment(self, ctx: MyParser.SimpleAssignmentContext):
8888
def exitSimpleAssignment(self, ctx: MyParser.SimpleAssignmentContext):
8989
if (
9090
isinstance(ctx.getChild(0), MyParser.IdContext)
91-
and self.variables[ctx.getChild(0).getText()] is Type.TBD
91+
and self.variables[(var := ctx.getChild(0).getText())] is Type.TBD
9292
):
9393
if self.expr_type[ctx.getChild(2)] is Type.TBD:
9494
ctx.parser.notifyErrorListeners(
9595
"Using a variable while declaring it is not allowed",
9696
ctx.getChild(1).getSymbol(),
9797
)
98-
self.variables[ctx.getChild(0).getText()] = None
98+
self.variables[var] = None
9999
else:
100-
self.variables[ctx.getChild(0).getText()] = self.expr_type[ctx.getChild(2)]
100+
self.variables[var] = self.expr_type[ctx.getChild(2)]
101101

102102
def exitCompoundAssignment(self, ctx: MyParser.CompoundAssignmentContext):
103103
pass

0 commit comments

Comments
 (0)