translator: fix default value for void
This commit is contained in:
@@ -12,16 +12,11 @@ import org.kotlinnative.translator.llvm.LLVMVariable
|
|||||||
class PropertyCodegen(val state: TranslationState, val property: KtProperty, val codeBuilder: LLVMBuilder) {
|
class PropertyCodegen(val state: TranslationState, val property: KtProperty, val codeBuilder: LLVMBuilder) {
|
||||||
private val variableManager = state.variableManager
|
private val variableManager = state.variableManager
|
||||||
|
|
||||||
companion object PropertyState {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun generate() {
|
fun generate() {
|
||||||
val varInfo = state.bindingContext.get(BindingContext.VARIABLE, property)?.compileTimeInitializer ?: return
|
val varInfo = state.bindingContext.get(BindingContext.VARIABLE, property)?.compileTimeInitializer ?: return
|
||||||
|
|
||||||
val kotlinType = varInfo.type
|
val kotlinType = varInfo.type
|
||||||
val value = varInfo.value
|
val value = varInfo.value
|
||||||
//[TODO] compile time initizializer
|
|
||||||
if (kotlinType.nameIfStandardType != null) {
|
if (kotlinType.nameIfStandardType != null) {
|
||||||
val variableType = LLVMMapStandardType(property.name ?: return, kotlinType).type
|
val variableType = LLVMMapStandardType(property.name ?: return, kotlinType).type
|
||||||
val variable = LLVMVariable(property.name.toString(), variableType, property.name.toString(), LLVMGlobalScope(), pointer = true)
|
val variable = LLVMVariable(property.name.toString(), variableType, property.name.toString(), LLVMGlobalScope(), pointer = true)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class LLVMVoidType() : LLVMType() {
|
|||||||
|
|
||||||
override val align = 0
|
override val align = 0
|
||||||
override val size: Byte = 0
|
override val size: Byte = 0
|
||||||
override val defaultValue = throw UnsupportedOperationException()
|
override val defaultValue = ""
|
||||||
|
|
||||||
override fun toString(): String = "void"
|
override fun toString(): String = "void"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user