@@ -427,7 +427,11 @@ static void cIf() {
cAddOperation(OP_GOTO);
int elseP = cReserveInt();
cSetInt(ifP, code->length);
- cConsumeBody();
+ if(cConsumeTokenIf(T_IF)) {
+ cIf();
+ } else {
+ cConsumeBody();
+ }
cSetInt(elseP, code->length);
}
@@ -0,0 +1,24 @@
+function test(a) {
+ if(a == 1) {
+ print 10;
+ } else if(a == 1) {
+ print null;
+ } else if(a == 2) {
+ print 20;
+ } else if(a == 3) {
+ print 30;
+ } else if(a == 4) {
+ print 40;
+ print 50;
+}
+test(0);
+test(1);
+test(2);
+test(3);
+test(4);
+test(5);
+test(6);
@@ -0,0 +1,7 @@
+50
+10
+20
+30
+40