Closed MANKEYYENAME closed 2 years ago
Currently T(args)
syntax is only implemented for structs, for other types it is still on TODO list.
You cannot pass $alias
directly to ExitProcess(getHey());
, first you need to assign it to the alias
declaration.
u32 hey;
$alias getHey(){
return hey; // this doesn't work atm
}
void main(){
alias var = getHey();
ExitProcess(var);
}
noreturn ExitProcess(u32 uExitCode);
But taking alias implicitly in return statement is not yet implemented for non-types. Will fix this soon.
Now for this code:
u32 hey;
$alias getHey() {
return $alias(hey);
}
void foo(u32 a){}
void main() {
foo(getHey());
}
you will get:
test.vx:3:18: Error: Cannot call basic type
test.vx:7:15: Error: Argument 1, must have type u32, not $alias
and this one will work as you want:
u32 hey;
$alias getHey() {
return hey;
}
void foo(u32 a){}
void main() {
alias var = getHey();
foo(var);
}
Compiler crashes