Commit c94d3e59 authored by Tom Niget's avatar Tom Niget

Add preliminary support for is/is not

parent 5b953fba
...@@ -6,7 +6,9 @@ from transpiler.utils import linenodata ...@@ -6,7 +6,9 @@ from transpiler.utils import linenodata
DUNDER = { DUNDER = {
ast.Eq: "eq", ast.Eq: "eq",
ast.Is: "eq", # TODO
ast.NotEq: "ne", ast.NotEq: "ne",
ast.IsNot: "ne", # TODO
ast.Lt: "lt", ast.Lt: "lt",
ast.Gt: "gt", ast.Gt: "gt",
ast.GtE: "ge", ast.GtE: "ge",
...@@ -29,7 +31,7 @@ class DesugarCompare(ast.NodeTransformer): ...@@ -29,7 +31,7 @@ class DesugarCompare(ast.NodeTransformer):
[], [],
**lnd **lnd
) )
if type(op) == ast.NotIn: if type(op) in (ast.NotIn, ast.IsNot):
call = ast.UnaryOp(ast.Not(), call, **lnd) call = ast.UnaryOp(ast.Not(), call, **lnd)
res.values.append(call) res.values.append(call)
if len(res.values) == 1: if len(res.values) == 1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment