@Override void compile(CompileContext ctx, boolean push) { boolean has_rest_arg = false; int arg_count = 0; for (int i = 0; init != null && i < init.size(); i++) { Expression exp = init.get(i); // System.out.println("st:"+ctx.get_stack_depth()+" before "+exp); if (exp.isRestArg()) { ((RestArgExpression) exp).compile(ctx, push, arg_count); has_rest_arg = true; break; } exp.compile(ctx, push); arg_count += 1; } // System.out.println("st:"+ctx.get_stack_depth()+" after loop"); if (push) { ctx.emit_new_array(has_rest_arg ? 0 : arg_count, has_rest_arg); // System.out.println("st:"+ctx.get_stack_depth()+" after new_array("+arg_count+", // "+has_rest_arg+")"); } }
void compile(CompileContext ctx, boolean push) { if (push) { int idx = ctx.getConstantPool().add_integer(text, radix); ctx.emit_push_constant(idx); } }