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

View File

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