-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
While exploring the codebase with the maker himself, we encountered a bug where for the code below
let a = 10;
let b = 15;
function max(a, b) {
function inner_max(a, b) {
if (a > b) {
return a;
} else {
return b;
}
}
return inner_max(a,b);
}
let m = max(a, b);the function will not be present in the final functions table prepared and there when when this program is executed
Program {
main: [
LoadConst(Number(10)), DeclareVar("a"),
LoadConst(Number(15)), DeclareVar("b"),
LoadVar("a"),
LoadVar("b"),
CallFunction("max", 2),
DeclareVar("m")
], functions: {
"max": FunctionBytecode { params: ["a", "b"], instructions: [
LoadVar("a"),
LoadVar("b"),
CallFunction("inner_max", 2), Return
]}
}
}
function inner_max will give the error
thread 'main' (25133346) panicked at src/vm/mod.rs:256:57:
undefined function
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels