Skip to content

Commit

Permalink
Fix bug: should not raise a SyntaxError when comparisons other than…
Browse files Browse the repository at this point in the history
… assignments encountered
  • Loading branch information
hsfzxjy committed Feb 7, 2021
1 parent 2a69d34 commit 73c228d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lambdex/compiler/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ def r_while(node: ast.Subscript, ctx: Context, clauses: list):

@Rules.register(ast.Assign)
def r_assign(node: ast.Compare, ctx: Context):
*targets, value = check_compare(ctx, node, ast.Lt)
try:
*targets, value = check_compare(ctx, node, ast.Lt)
except SyntaxError:
return copy_lineinfo(
node,
ast.Expr(ctx.compile(node, flag=ContextFlag.should_be_expr)),
)

for target in targets:
ctx.assert_lvalue(target)
Expand Down

0 comments on commit 73c228d

Please sign in to comment.