Commit 4827539e authored by Tom Niget's avatar Tom Niget

Fix assignment for class types

parent f5b67d50
# coding: utf-8 # coding: utf-8
# norun
# https://lab.nexedi.com/xavier_thompson/typon-snippets/tree/master/references # https://lab.nexedi.com/xavier_thompson/typon-snippets/tree/master/references
class Person: class Person:
name: str name: str
...@@ -13,13 +12,12 @@ class Person: ...@@ -13,13 +12,12 @@ class Person:
def afficher(self): def afficher(self):
print("afficher", self.name, self.age) print("afficher", self.name, self.age)
# def creer(): def creer():
# return Person("jean", 123) return Person("jean", 123)
if __name__ == "__main__": if __name__ == "__main__":
y = Person y = Person
#x = creer() x = creer()
x = Person("jean", 123)
print("name", x.name) print("name", x.name)
print("age", x.age) print("age", x.age)
x.afficher() x.afficher()
......
...@@ -28,6 +28,7 @@ def emit_class(name: str, node: ConcreteType) -> Iterable[str]: ...@@ -28,6 +28,7 @@ def emit_class(name: str, node: ConcreteType) -> Iterable[str]:
yield ">" yield ">"
yield f"struct {name}__oo : referencemodel::classtype<_Base0, {name}__oo<>> {{" yield f"struct {name}__oo : referencemodel::classtype<_Base0, {name}__oo<>> {{"
yield f"static constexpr std::string_view name = \"{name}\";" yield f"static constexpr std::string_view name = \"{name}\";"
yield f"auto operator=(const {name}__oo&) const {{ return *this; }}"
# inner = ClassInnerVisitor2(node.inner_scope) # inner = ClassInnerVisitor2(node.inner_scope)
# for stmt in node.body: # for stmt in node.body:
......
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