ammend to prev commit

This commit is contained in:
TopchetoEU 2024-09-04 10:41:52 +03:00
parent 2a5f6aa9aa
commit f929015f55
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
2 changed files with 4 additions and 5 deletions

View File

@ -18,13 +18,13 @@ public class ArrayNode extends Node {
@Override public void compile(CompileResult target, boolean pollute) {
target.add(Instruction.loadArr(statements.length));
if (statements.length > 0) target.add(Instruction.dup(statements.length));
for (var i = 0; i < statements.length; i++) {
var el = statements[i];
if (el != null) {
target.add(Instruction.dup());
target.add(Instruction.pushValue(i));
el.compile(target, true);
target.add(Instruction.storeMember());
target.add(Instruction.storeMember(i));
}
}

View File

@ -39,10 +39,9 @@ public class ObjectNode extends Node {
for (var el : map.entrySet()) {
target.add(Instruction.dup());
target.add(Instruction.pushValue(el.getKey()));
var val = el.getValue();
FunctionNode.compileWithName(val, target, true, el.getKey().toString());
target.add(Instruction.storeMember());
target.add(Instruction.storeMember(el.getKey()));
}
var keys = new ArrayList<Object>();