Commit 0fa05177 authored by Tom Niget's avatar Tom Niget

Fix repr syntax to match Python's

parent 6db2aaa1
...@@ -33,13 +33,13 @@ class ClassVisitor(NodeVisitor): ...@@ -33,13 +33,13 @@ class ClassVisitor(NodeVisitor):
yield "}" yield "}"
else: else:
yield "void py_repr(std::ostream &s) const {" yield "void py_repr(std::ostream &s) const {"
yield "s << '{';" yield f's << "{node.name}(";'
for i, (name, memb) in enumerate(node.type.get_members().items()): for i, (name, memb) in enumerate(node.type.get_members().items()):
if i != 0: if i != 0:
yield 's << ", ";' yield 's << ", ";'
yield f's << "\\"{name}\\": ";' yield f's << "{name}=";'
yield f"repr_to({name}, s);" yield f"repr_to({name}, s);"
yield "s << '}';" yield "s << ')';"
yield "}" yield "}"
yield "void py_print(std::ostream &s) const {" yield "void py_print(std::ostream &s) const {"
......
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