From: Jean Privat Date: Fri, 10 Oct 2014 01:49:22 +0000 (-0400) Subject: compiler: add Visitor::bool_instance X-Git-Tag: v0.6.10~34^2~6 X-Git-Url: http://nitlanguage.org compiler: add Visitor::bool_instance Signed-off-by: Jean Privat --- diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index df39d60..c8fd126 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -1355,6 +1355,18 @@ abstract class AbstractCompilerVisitor return res end + # Generate an integer value + fun bool_instance(value: Bool): RuntimeVariable + do + var res = self.new_var(self.get_class("Bool").mclass_type) + if value then + self.add("{res} = 1;") + else + self.add("{res} = 0;") + end + return res + end + # Generate a string value fun string_instance(string: String): RuntimeVariable do