2021-10-02 19:05:35 +08:00
|
|
|
@extern
|
2021-12-13 11:18:44 +08:00
|
|
|
def output_int32(x: int32):
|
2021-10-02 19:05:35 +08:00
|
|
|
...
|
|
|
|
|
2021-12-13 04:06:38 +08:00
|
|
|
@extern
|
2021-12-13 11:18:44 +08:00
|
|
|
def output_int64(x: int64):
|
2021-12-13 04:06:38 +08:00
|
|
|
...
|
|
|
|
|
2024-06-19 18:16:54 +08:00
|
|
|
@extern
|
|
|
|
def output_str(x: str):
|
|
|
|
...
|
|
|
|
|
2021-10-02 19:05:35 +08:00
|
|
|
|
2022-01-23 10:35:06 +08:00
|
|
|
class B:
|
|
|
|
b: int32
|
|
|
|
def __init__(self, a: int32):
|
|
|
|
self.b = a
|
|
|
|
|
|
|
|
|
2021-09-19 22:54:06 +08:00
|
|
|
class A:
|
|
|
|
a: int32
|
2021-09-20 23:26:04 +08:00
|
|
|
b: B
|
2021-09-19 22:54:06 +08:00
|
|
|
def __init__(self, a: int32):
|
|
|
|
self.a = a
|
2021-09-20 23:26:04 +08:00
|
|
|
self.b = B(a + 1)
|
2021-09-19 17:50:01 +08:00
|
|
|
|
2021-09-19 22:54:06 +08:00
|
|
|
def get_a(self) -> int32:
|
|
|
|
return self.a
|
2021-09-20 23:26:04 +08:00
|
|
|
|
2024-01-29 12:49:50 +08:00
|
|
|
# def get_b(self) -> B:
|
|
|
|
# return self.b
|
2021-09-20 23:26:04 +08:00
|
|
|
|
2021-09-19 17:50:01 +08:00
|
|
|
|
2024-06-19 18:16:54 +08:00
|
|
|
class Initless:
|
|
|
|
def foo(self):
|
|
|
|
output_str("hello")
|
|
|
|
|
2021-09-19 17:50:01 +08:00
|
|
|
def run() -> int32:
|
2021-09-19 22:54:06 +08:00
|
|
|
a = A(10)
|
2021-12-13 11:18:44 +08:00
|
|
|
output_int32(a.a)
|
2021-09-19 17:50:01 +08:00
|
|
|
|
2021-09-19 22:54:06 +08:00
|
|
|
a = A(20)
|
2021-12-13 11:18:44 +08:00
|
|
|
output_int32(a.a)
|
|
|
|
output_int32(a.get_a())
|
2022-01-23 10:35:06 +08:00
|
|
|
# output_int32(a.get_b().b) FIXME: NAC3 prints garbage
|
2024-06-19 18:16:54 +08:00
|
|
|
|
|
|
|
initless = Initless()
|
|
|
|
initless.foo()
|
|
|
|
|
2020-03-30 22:47:45 +08:00
|
|
|
return 0
|