Commit 3ddf3249 authored by Tom Niget's avatar Tom Niget

Allow passing type objects around

parent 173e8636
......@@ -4,7 +4,7 @@ class Person:
name: str
age: int
def __init__(self, name: str, age: int):
def __init__(self, name, age):
self.name = name
self.age = age
......@@ -15,6 +15,7 @@ def creer():
return Person("jean", 123)
if __name__ == "__main__":
y = Person
x = creer()
print(x.name)
print(x.age)
......
......@@ -6,7 +6,8 @@ from typing import Iterable
from transpiler.phases.emit_cpp.consts import MAPPINGS
from transpiler.phases.typing import TypeVariable
from transpiler.phases.typing.types import BaseType, TY_INT, TY_BOOL, TY_NONE, Promise, PromiseKind, TY_STR, UserType
from transpiler.phases.typing.types import BaseType, TY_INT, TY_BOOL, TY_NONE, Promise, PromiseKind, TY_STR, UserType, \
TypeType
from transpiler.utils import UnsupportedNodeError
class UniversalVisitor:
......@@ -59,6 +60,8 @@ class NodeVisitor(UniversalVisitor):
yield "std::string"
elif isinstance(node, UserType):
yield f"std::shared_ptr<decltype({node.name})::type>"
elif isinstance(node, TypeType):
yield "auto" # TODO
elif isinstance(node, Promise):
yield "typon::"
if node.kind == PromiseKind.TASK:
......
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