fix(muscript): evaluate bind parameters early
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
86e34a1f16
commit
0c2db6fe08
|
@ -4,6 +4,7 @@ import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||||
import io.gitlab.jfronny.muscript.compiler.*;
|
import io.gitlab.jfronny.muscript.compiler.*;
|
||||||
import io.gitlab.jfronny.muscript.data.Scope;
|
import io.gitlab.jfronny.muscript.data.Scope;
|
||||||
|
import io.gitlab.jfronny.muscript.data.dynamic.DCallable;
|
||||||
import io.gitlab.jfronny.muscript.data.dynamic.additional.DFinal;
|
import io.gitlab.jfronny.muscript.data.dynamic.additional.DFinal;
|
||||||
import io.gitlab.jfronny.muscript.data.dynamic.Dynamic;
|
import io.gitlab.jfronny.muscript.data.dynamic.Dynamic;
|
||||||
|
|
||||||
|
@ -24,13 +25,12 @@ public class Bind extends DynamicExpr {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dynamic get(Scope dataRoot) {
|
public Dynamic get(Scope dataRoot) {
|
||||||
|
Dynamic param = parameter.get(dataRoot);
|
||||||
|
DCallable clb = callable.get(dataRoot).asCallable();
|
||||||
return DFinal.of("<bind>", args -> {
|
return DFinal.of("<bind>", args -> {
|
||||||
List<Dynamic> argsWithParameter = new LinkedList<>(args.getValue());
|
List<Dynamic> argsWithParameter = new LinkedList<>(args.getValue());
|
||||||
argsWithParameter.add(0, parameter.get(dataRoot));
|
argsWithParameter.add(0, param);
|
||||||
return callable.get(dataRoot)
|
return clb.call(DFinal.of(argsWithParameter));
|
||||||
.asCallable()
|
|
||||||
.getValue()
|
|
||||||
.apply(DFinal.of(argsWithParameter));
|
|
||||||
}, () -> this);
|
}, () -> this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue