基线重置,修复了一些 bug

This commit is contained in:
TermiNexus committed 2026-09-07 14:46:02 +08:00
1 parent b02bedae9a
commit 45e78ad107
2421 files changed
+13195 -19306

No files matched your search

+10 -9
View File
@@ -1,20 +1,21 @@
import stdio
import stdlib
import stdint
import t, c
class SimpleData(t.Object):
class SimpleData():
x: t.CInt
y: t.CInt
class Point3D(t.Object):
class Point3D():
x: t.CFloat
y: t.CFloat
z: t.CFloat
class Student(t.Object):
class Student():
name: t.CChar | t.CPtr
age: t.CInt
score: t.CInt
@@ -31,7 +32,7 @@ class Student(t.Object):
return self.score
class Counter(t.Object):
class Counter():
value: t.CInt
def __init__(self, initial: t.CInt):
@@ -44,7 +45,7 @@ class Counter(t.Object):
return self.value
class StackObj(t.Object):
class StackObj():
data: t.CInt
next_ptr: t.CVoid | t.CPtr
@@ -99,10 +100,10 @@ def TestStackAllocation():
def TestHeapAllocation():
stdio.printf("=== Test Heap Allocation ===\n")
ptr: t.CVoid | t.CPtr = c.malloc(1024)
ptr: t.CVoid | t.CPtr = stdlib.malloc(1024)
if ptr != 0:
stdio.printf("Allocated 1024 bytes at %p\n", ptr)
c.free(ptr)
stdlib.free(ptr)
stdio.printf("Freed memory\n")
else:
stdio.printf("malloc failed\n")
@@ -111,10 +112,10 @@ def TestHeapAllocation():
def TestHeapObjectWithInit():
stdio.printf("=== Test Heap Object with Init ===\n")
mem_size: t.CSizeT = 256
ptr: t.CVoid | t.CPtr = c.malloc(mem_size)
ptr: t.CVoid | t.CPtr = stdlib.malloc(mem_size)
if ptr != 0:
stdio.printf("Allocated %d bytes\n", mem_size)
c.free(ptr)
stdlib.free(ptr)
else:
stdio.printf("malloc failed\n")