[CHANGED] only generate required labels in if-else

This commit is contained in:
sjs 2009-05-16 15:40:43 -07:00
parent 0431cd60f3
commit e547804711

View file

@ -162,16 +162,15 @@ class Compiler
match('i')
condition
else_label = unique_label(:else)
end_label = unique_label(:end)
end_label = else_label # only generated if else clause present
x86_jz(else_label)
block
if @look == 'l'
match('l')
end_label = unique_label(:end) # now we need the 2nd label
x86_jmp(end_label)
emit_label(else_label)
block
else
emit_label(else_label) # we end up with an extra label, oh well
end
match('e')
emit_label(end_label)