GAMEEEEEEEEEE
This commit is contained in:
parent
859e7d7560
commit
e0a42d0262
45 changed files with 2771 additions and 782 deletions
36
tests/codegen/test_comprehensive.sui
Normal file
36
tests/codegen/test_comprehensive.sui
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
struct Point
|
||||
x: int,
|
||||
y: int,
|
||||
end
|
||||
|
||||
enum Status
|
||||
Ok,
|
||||
Error,
|
||||
end
|
||||
|
||||
fn add(a: int, b: int) -> int do
|
||||
a + b
|
||||
end
|
||||
|
||||
fn main() -> int do
|
||||
# Test stack-allocated types (copyable)
|
||||
let x = 10;
|
||||
let y = 20;
|
||||
let sum = add(x, y);
|
||||
|
||||
# Test struct (stack-allocated for now, but declared as such in language)
|
||||
let p = Point { x: 5, y: 15 };
|
||||
let point_sum = p.x + p.y;
|
||||
|
||||
# Test enum (stack-allocated for now)
|
||||
let status = Status::Ok();
|
||||
|
||||
# Test array (heap-allocated)
|
||||
let arr = [1, 2, 3, 4, 5];
|
||||
let first = arr[0];
|
||||
|
||||
# Test string (heap-allocated)
|
||||
let msg = "hello";
|
||||
sum + point_sum + first
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue