fix: array statements broken when empty elements
This commit is contained in:
parent
63ccd5757e
commit
b9268518f6
@ -18,11 +18,10 @@ public class ArrayNode extends Node {
|
|||||||
@Override public void compile(CompileResult target, boolean pollute) {
|
@Override public void compile(CompileResult target, boolean pollute) {
|
||||||
target.add(Instruction.loadArr(statements.length));
|
target.add(Instruction.loadArr(statements.length));
|
||||||
|
|
||||||
if (statements.length > 0) target.add(Instruction.dup(statements.length));
|
|
||||||
|
|
||||||
for (var i = 0; i < statements.length; i++) {
|
for (var i = 0; i < statements.length; i++) {
|
||||||
var el = statements[i];
|
var el = statements[i];
|
||||||
if (el != null) {
|
if (el != null) {
|
||||||
|
target.add(Instruction.dup());
|
||||||
el.compile(target, true);
|
el.compile(target, true);
|
||||||
target.add(Instruction.storeMember(i));
|
target.add(Instruction.storeMember(i));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user