WIP unpacking of parameters.

This commit is contained in:
gnembon committed 2021-04-21 12:21:47 -03:00
1 parent 72a3d74a97
commit a65d16c9ba
11 files changed
+106 -30

No files matched your search

@@ -1,6 +1,7 @@
package carpet.script.argument;
import carpet.script.Context;
import carpet.script.Fluff;
import carpet.script.LazyValue;
import carpet.script.ScriptHost;
import carpet.script.bundled.Module;
@@ -94,4 +95,14 @@ public class FunctionArgument<T> extends Argument
return new FunctionArgument<>(function, 0, args);
}
public void checkArgs() {
function.checkArgs(args.size());
}
public List<Value> unpackArgs(Context c) {
List<Value> unpackedArgs = Fluff.AbstractFunction.unpackArgs((List<LazyValue>) args, c);
function.checkArgs(unpackedArgs.size());
return unpackedArgs;
}
}