Handle String constructor call in code generator

This commit is contained in:
Svyatoslav Scherbina
2017-03-17 18:40:37 +07:00
committed by SvyatoslavScherbina
parent bb1c52c23b
commit 47dfe122fc
@@ -1659,6 +1659,11 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
assert(args.size >= 1 && args[0].type == int32Type)
codegen.allocArray(codegen.typeInfoValue(constructedClass), args[0],
resultLifetime(callee))
} else if (constructedClass == context.builtIns.string) {
// TODO: consider returning the empty string literal instead.
assert(args.size == 0)
codegen.allocArray(codegen.typeInfoValue(constructedClass), count = kImmZero,
lifetime = resultLifetime(callee))
} else {
codegen.allocInstance(codegen.typeInfoValue(constructedClass), resultLifetime(callee))
}