fixed an unexpected compiler bug caused by wrong ifdef while processing a lable at the end of a braced block
This commit is contained in:
parent
201b475133
commit
623c9b9198
@ -189,10 +189,10 @@ start:
|
||||
[ self test_while_001 ],
|
||||
[ (if (1 > 2) { } else { }) == nil. ],
|
||||
[ (if (1 < 2) { } else { }) == nil. ],
|
||||
[ (if (1 > 2) { } else { goto A01. A01: }) == nil ],
|
||||
[ (if (1 > 2) { } else { goto A01. A01: nil }) == nil ],
|
||||
|
||||
// 25-29
|
||||
[ (if (1 > 2) { } else { 9876. goto A02. A02: }) == 9876 ],
|
||||
[ (if (1 > 2) { } else { 9876. goto A02. A02: 9876. }) == 9876 ],
|
||||
[ [ | a3 | a3:= 20. if (a3 == 21) { a3 := 4321. goto L03 } else { a3 := 1234. goto L03 }. a3 := 8888. L03: a3 ] value == 1234 ],
|
||||
[ [ | a4 | a4:= 21. if (a4 == 21) { a4 := 4321. goto L04 } else { a4 := 1234. goto L04 }. a4 := 8888. L04: a4 ] value == 4321 ]
|
||||
).
|
||||
|
@ -6472,19 +6472,12 @@ static int compile_braced_block (moo_t* moo)
|
||||
MOO_ASSERT (moo, md->_label != MOO_NULL);
|
||||
if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACE)
|
||||
{
|
||||
#if 0
|
||||
/* the last label inside {} must be followed by a valid statement */
|
||||
moo_oocs_t labname;
|
||||
labname.ptr = (moo_ooch_t*)(md->_label + 1);
|
||||
labname.len = moo_count_oocstr(labname.ptr);
|
||||
moo_setsynerrbfmt (moo, MOO_SYNERR_LABELATEND, &md->_label->loc, &labname, "label at end of braced block");
|
||||
return -1;
|
||||
#else
|
||||
/* unlike in [], a label can be placed at the back of the block.
|
||||
* to keep the last evaluated value, eliminate the pop_stacktop instruction */
|
||||
if (pop_stacktop_pos > 0) eliminate_instructions (moo, pop_stacktop_pos, pop_stacktop_pos);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (n == 7777)
|
||||
|
Loading…
Reference in New Issue
Block a user