pusharg takes multiple args at same time

This commit is contained in:
2025-09-20 12:57:03 +10:00
parent cc896629f7
commit 1147383ece
2 changed files with 17 additions and 7 deletions

View File

@@ -1911,12 +1911,14 @@ Literal exec(vector<Instruction> in, bool executingFunction) {
if (l.args.size() < 1) {
error("Could not find all arguments required for Endfun inbuilt");
}
if (holds_alternative<Literal>(l.args[0])) {
fnArgs.push_back(get<Literal>(l.args[0]));
} else if (holds_alternative<ListRef>(l.args[0])) {
fnArgs.push_back(variables[get<ListRef>(l.args[0]).listName]);
} else {
error("First argument of pusharg must be a literal or list reference");
for (int k = 0; k < l.args.size(); k++) {
if (holds_alternative<Literal>(l.args[k])) {
fnArgs.push_back(get<Literal>(l.args[k]));
} else if (holds_alternative<ListRef>(l.args[k])) {
fnArgs.push_back(variables[get<ListRef>(l.args[k]).listName]);
} else {
error("First argument of pusharg must be a literal or list reference");
}
}
break;
/*

View File

@@ -38,4 +38,12 @@ stdlnout $tmp
add 1 $counter &counter
jump %loopstart
@loopend
end 0
fun -int !doSomething -int &a -string &b
println $a
println $b
return 0
endfun
pusharg 432 "dingle"
!doSomething &ret