still need to fix literal arrays, it has the same problem as struct literals had with moving the literal into memory and modifying the memory with variables
48 lines
670 B
Plaintext
48 lines
670 B
Plaintext
type str = [u8];
|
|
|
|
include "std.mcl";
|
|
|
|
struct Foo {
|
|
a: usize,
|
|
b: &str
|
|
}
|
|
|
|
fn Foo.new(a: usize, b: &str) -> &Foo {
|
|
return &Foo {
|
|
a: a,
|
|
b: b
|
|
};
|
|
}
|
|
|
|
fn print(s: &str) {
|
|
// do nothign for now
|
|
}
|
|
|
|
fn mul(n: usize, n2: usize) -> usize {
|
|
return n * n2;
|
|
}
|
|
|
|
fn main() -> i32 {
|
|
let obj = Foo::new(1, "owo");
|
|
obj->b;
|
|
let owo = "ahahaha";
|
|
loop {
|
|
print(owo);
|
|
}
|
|
|
|
for (let i = 0; i < 10; i += 1) {
|
|
print("nyaaa");
|
|
if (i > 7) {
|
|
break;
|
|
} else {
|
|
continue;
|
|
}
|
|
print("cant see me!");
|
|
}
|
|
while (true) {
|
|
mul(1);
|
|
}
|
|
}
|
|
|
|
const FOO: usize = main;
|