fix(muscript): skip unneeded decompile/recompile step and use getLast

This commit is contained in:
Johannes Frohnmeyer 2024-04-07 15:17:01 +02:00
parent 21a7cfcc39
commit b6e9923fcf
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ public class Closure extends DynamicExpr {
@Override
public DCallable get(Scope dataRoot) {
return DFinal.of(getSignature(), args -> {
return DFinal.of(getSignature(), null, args -> {
// Compare with ExprGroup.get()
int ac = args.size();
int ae = boundArgs.size();
@ -54,7 +54,7 @@ public class Closure extends DynamicExpr {
Scope fork = dataRoot.fork();
for (int i = 0; i < ae; i++) fork.set(boundArgs.get(i), args.get(i));
if (variadic) {
fork.set(boundArgs.get(boundArgs.size() - 1), IntStream.range(ae, ac)
fork.set(boundArgs.getLast(), IntStream.range(ae, ac)
.mapToObj(args::get)
.toList());
}
@ -62,7 +62,7 @@ public class Closure extends DynamicExpr {
step.get(fork);
}
return fin.get(fork);
}, this::toString);
}, () -> this);
}
@Override