Commit c162e3ec authored by Tom Niget's avatar Tom Niget

Add support for `in` operator

parent c25f0293
......@@ -156,6 +156,11 @@ class ExpressionVisitor(NodeVisitor):
yield from self.visit_binary_operation(node.op, node.left, node.right)
def visit_binary_operation(self, op, left: ast.AST, right: ast.AST) -> Iterable[str]:
if type(op) == ast.In:
call = ast.Call(ast.Attribute(right, "__contains__"), [left], [])
call.is_await = False
yield from self.visit_Call(call)
return
op = SYMBOLS[type(op)]
# TODO: handle precedence locally since only binops really need it
# we could just store the history of traversed nodes and check if the last one was a binop
......
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