Commit d5d148a6 authored by Tom Niget's avatar Tom Niget

Add hack to allow for self reference in type decls inside classes

parent a161a389
...@@ -9,7 +9,9 @@ from transpiler.phases.emit_cpp import NodeVisitor, FunctionEmissionKind ...@@ -9,7 +9,9 @@ from transpiler.phases.emit_cpp import NodeVisitor, FunctionEmissionKind
class ClassVisitor(NodeVisitor): class ClassVisitor(NodeVisitor):
def visit_ClassDef(self, node: ast.ClassDef) -> Iterable[str]: def visit_ClassDef(self, node: ast.ClassDef) -> Iterable[str]:
yield "struct {" yield f"struct {node.name}_s;"
yield f"extern {node.name}_s {node.name};"
yield f"struct {node.name}_s {{"
yield "struct type {" yield "struct type {"
inner = ClassInnerVisitor(node.inner_scope) inner = ClassInnerVisitor(node.inner_scope)
......
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