Commit 9b8da153 authored by Tom Niget's avatar Tom Niget

Fix sync function generation

parent 29793d0f
def f[T](x: T):
return x
def g[X](a: X, b: X):
return a + b
if __name__ == "__main__":
#a = 5
print(f("abc"))
print(f(6))
print(g(6, 8))
print(g("abc", "def"))
......@@ -222,13 +222,17 @@ class ExpressionVisitor(NodeVisitor):
yield from self.visit_binary_operation(node.ops[0], node.left, node.comparators[0], linenodata(node))
def visit_binary_operation(self, op, left: ast.AST, right: ast.AST, lnd: dict) -> Iterable[str]:
yield "(co_await ("
if self.generator != CoroutineMode.SYNC:
yield "(co_await"
yield "("
yield from self.visit(left)
yield " "
yield SYMBOLS[type(op)]
yield " "
yield from self.visit(right)
yield "))"
yield ")"
if self.generator != CoroutineMode.SYNC:
yield ")"
return
raise NotImplementedError()
# if type(op) == ast.In:
......
......@@ -75,6 +75,7 @@ class NodeVisitor(UniversalVisitor):
if em:
yield name
else:
raise UnresolvedTypeVariableError(node)
yield f"$VAR__{name}"
#raise UnresolvedTypeVariableError(node)
......
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