Files
Noja/tests/suite/Testcase_011_008
T

49 lines
828 B
Plaintext

#source
fun add(a: int, b: int) {
return a + b;
}
#bytecode
PUSHFUN fun, 2;
ASS "add";
POP 1;
JUMP end;
fun:
PUSHTYP;
PUSHVAR "int";
PUSHTYP;
PUSHTYPTYP;
EQL;
JUMPIFNOTANDPOP arg1_annot0_not_type;
EQL;
JUMPIFANDPOP arg1_ok;
ERROR "Bad type for argument 1";
arg1_annot0_not_type:
ERROR "Argument 1 type annotation 0 is not a type";
arg1_ok:
ASS "b";
POP 1;
PUSHTYP;
PUSHVAR "int";
PUSHTYP;
PUSHTYPTYP;
EQL;
JUMPIFNOTANDPOP arg0_annot0_not_type;
EQL;
JUMPIFANDPOP arg0_ok;
ERROR "Bad type for argument 0";
arg0_annot0_not_type:
ERROR "Argument 0 type annotation 0 is not a type";
arg0_ok:
ASS "a";
POP 1;
PUSHVAR "a";
PUSHVAR "b";
ADD;
RETURN 1;
RETURN 0;
end:
RETURN 0;