ES6 Support Groundwork + Fixes #26

Merged
TopchetoEU merged 49 commits from ES6 into master 2024-09-05 14:26:07 +00:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit f929015f55 - Show all commits

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>();