2021-06-01 19:58:46 +00:00
|
|
|
struct Foo {
|
|
|
|
static Func2<U>(u: U) : U {
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Func<T>(t: T): T {
|
|
|
|
foo: T = t;
|
|
|
|
return Foo.Func2(foo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-03 00:26:26 +00:00
|
|
|
struct MemoryBlock<T>
|
|
|
|
{
|
|
|
|
start: MemoryAddress;
|
|
|
|
capacity: uint;
|
|
|
|
|
|
|
|
AddressOf(count: uint): MemoryAddress
|
|
|
|
{
|
|
|
|
return start + (count * @sizeof<T>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-01 19:58:46 +00:00
|
|
|
struct Program {
|
|
|
|
static Main(): int {
|
|
|
|
x: int = 4;
|
|
|
|
y: int = Foo.Func(x);
|
2021-06-03 02:03:58 +00:00
|
|
|
block: MemoryBlock<int>;
|
2021-06-02 19:44:36 +00:00
|
|
|
addr: MemoryAddress = @malloc(y);
|
2021-06-02 19:33:01 +00:00
|
|
|
@free(addr);
|
2021-06-01 19:58:46 +00:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
}
|