Commit 6ecfe8a2 authored by Tom Niget's avatar Tom Niget

Add specific repr implementation for enums

parent 8e1f1ddf
......@@ -25,6 +25,13 @@ class ClassVisitor(NodeVisitor):
yield "py_type(const py_type&) = delete;"
yield "py_type(py_type&&) = delete;"
if getattr(node.type, "is_enum", False):
yield "int value;"
yield "operator int() const { return value; }"
yield "void py_repr(std::ostream &s) const {"
yield f's << "{node.name}." << value;'
yield "}"
else:
yield "void py_repr(std::ostream &s) const {"
yield "s << '{';"
for i, (name, memb) in enumerate(node.type.members.items()):
......
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