Implement printing of booleans

This commit is contained in:
Ayke van Laethem
2018-08-22 00:54:39 +02:00
parent a30ffa5c1e
commit 2777f8464e
2 changed files with 10 additions and 1 deletions
+2 -1
View File
@@ -1008,7 +1008,8 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string)
panic("undefined: " + name)
}
c.builder.CreateCall(fn, []llvm.Value{value}, "")
continue
} else if typ.Kind() == types.Bool {
c.builder.CreateCall(c.mod.NamedFunction("runtime.printbool"), []llvm.Value{value}, "")
} else {
return llvm.Value{}, errors.New("unknown basic arg type: " + typ.String())
}
+8
View File
@@ -101,3 +101,11 @@ func printptr(ptr uintptr) {
ptr <<= 4
}
}
func printbool(b bool) {
if b {
printstring("true")
} else {
printstring("false")
}
}