mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
Implement printing of booleans
This commit is contained in:
+2
-1
@@ -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())
|
||||
}
|
||||
|
||||
@@ -101,3 +101,11 @@ func printptr(ptr uintptr) {
|
||||
ptr <<= 4
|
||||
}
|
||||
}
|
||||
|
||||
func printbool(b bool) {
|
||||
if b {
|
||||
printstring("true")
|
||||
} else {
|
||||
printstring("false")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user