translator: fix issue with string fucntion argument

This commit is contained in:
Alexey Stepanov
2016-08-11 11:50:12 +03:00
parent 7c01c2f2bc
commit 7faa437c7a
2 changed files with 7 additions and 0 deletions
@@ -23,6 +23,7 @@ fun LLVMInstanceOfStandardType(name: String, type: KotlinType, scope: LLVMScope
type.toString() == "Long" -> LLVMVariable(name, LLVMLongType(), name, scope)
type.toString() == "Float" -> LLVMVariable(name, LLVMFloatType(), name, scope)
type.toString() == "Double" -> LLVMVariable(name, LLVMDoubleType(), name, scope)
type.toString() == "String" -> LLVMVariable(name, LLVMStringType(0), name, scope)
type.nameIfStandardType.toString() == "Nothing" -> LLVMVariable(name, LLVMNullType(), name, scope)
type.isUnit() -> LLVMVariable("", LLVMVoidType(), name, scope)
type.isMarkedNullable -> LLVMVariable(name, LLVMReferenceType(type.toString().dropLast(1)), name, scope, pointer = 1)
@@ -8,6 +8,12 @@ class LLVMStringType(override val length: Int) : LLVMArray, LLVMType() {
override fun mangle() = "String"
override fun equals(other: Any?): Boolean =
when (other) {
is LLVMStringType -> this.length == other.length
else -> false
}
override fun basicType() = LLVMCharType()
override val typename = "i8*"
override fun fullType() = "[${length + 1} x i8]"