Skip to content

Commit

Permalink
Fixes chained assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
d0c-s4vage committed Jan 9, 2020
1 parent 36a03d8 commit 1899314
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pfp/interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,7 @@ def assign_op(x, y):
if node.op not in switch:
raise errors.UnsupportedAssignmentOperator(node.coord, node.op)
switch[node.op](field, value)
return field

def _handle_func_def(self, node, scope, ctxt, stream):
"""Handle FuncDef nodes
Expand Down
15 changes: 15 additions & 0 deletions tests/test_control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ def test_fall_through_no_case_body3(self):
""",
)

def test_chained_assignment(self):
dom = self._test_parse_build(
"",
"""
local int b = 10;
local int c;
local int d;
c = d = b;
""",
)
self.assertEqual(dom.b is dom.c, False)
self.assertEqual(dom.b is dom.d, False)
self.assertEqual(dom.c is dom.d, False)


if __name__ == "__main__":
unittest.main()

0 comments on commit 1899314

Please sign in to comment.