From f946159869b0ebbc24a5742284403cc9241aa10d Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sun, 4 Jan 2015 21:18:19 -0500 Subject: [PATCH] compiler: create var in `shortcut_equate` only if needed Signed-off-by: Jean Privat --- src/compiler/separate_compiler.nit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 13f0bd7..54c51b2 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -1143,10 +1143,10 @@ class SeparateCompilerVisitor self.add("\{") end if not self.compiler.modelbuilder.toolcontext.opt_no_shortcut_equate.value and (mmethod.name == "==" or mmethod.name == "!=") then - if res == null then res = self.new_var(bool_type) - # Recv is not null, thus is arg is, it is easy to conclude (and respect the invariants) + # Recv is not null, thus if arg is, it is easy to conclude (and respect the invariants) var arg = arguments[1] if arg.mcasttype isa MNullType then + if res == null then res = self.new_var(bool_type) if mmethod.name == "==" then self.add("{res} = 0; /* arg is null but recv is not */") else -- 1.7.9.5