fix: array statements broken when empty elements

This commit is contained in:
TopchetoEU 2024-09-06 15:46:10 +03:00
parent 63ccd5757e
commit b9268518f6
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -18,11 +18,10 @@ 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());
el.compile(target, true);
target.add(Instruction.storeMember(i));
}