From e547804711b6a1c119fc8a56786e0f8fe1469c65 Mon Sep 17 00:00:00 2001 From: sjs Date: Sat, 16 May 2009 15:40:43 -0700 Subject: [PATCH] [CHANGED] only generate required labels in if-else --- compiler.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler.rb b/compiler.rb index ea99fdb..4b22397 100644 --- a/compiler.rb +++ b/compiler.rb @@ -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)