nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
88b180e
)
compiler: add Visitor::bool_instance
author
Jean Privat
<jean@pryen.org>
Fri, 10 Oct 2014 01:49:22 +0000
(21:49 -0400)
committer
Jean Privat
<jean@pryen.org>
Fri, 10 Oct 2014 01:49:22 +0000
(21:49 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>
src/compiler/abstract_compiler.nit
patch
|
blob
|
history
diff --git
a/src/compiler/abstract_compiler.nit
b/src/compiler/abstract_compiler.nit
index
df39d60
..
c8fd126
100644
(file)
--- 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