compiler,runtime: implement []rune to string conversion

This is used by a few packages in the standard library, at least
compress/gzip and regexp/syntax.
This commit is contained in:
Ayke van Laethem
2019-08-11 14:35:34 +02:00
committed by Ron Evans
parent fea56d4164
commit fd3309afa8
4 changed files with 33 additions and 1 deletions
+2
View File
@@ -2415,6 +2415,8 @@ func (c *Compiler) parseConvert(typeFrom, typeTo types.Type, value llvm.Value, p
switch typeFrom.Elem().(*types.Basic).Kind() {
case types.Byte:
return c.createRuntimeCall("stringFromBytes", []llvm.Value{value}, ""), nil
case types.Rune:
return c.createRuntimeCall("stringFromRunes", []llvm.Value{value}, ""), nil
default:
return llvm.Value{}, c.makeError(pos, "todo: convert to string: "+typeFrom.String())
}