translator: small cleanup
This commit is contained in:
@@ -353,12 +353,9 @@ abstract class BlockCodegen(val state: TranslationState, val variableManager: Va
|
||||
private fun evaluateNameReferenceExpression(expr: KtNameReferenceExpression, classScope: StructCodegen): LLVMSingleValue? {
|
||||
val fieldName = state.bindingContext.get(BindingContext.REFERENCE_TARGET, expr)!!.name.toString()
|
||||
val companionObject = (classScope as ClassCodegen).companionObjectCodegen ?: throw UnexpectedException(expr.text)
|
||||
val field = companionObject.fieldsIndex[fieldName]
|
||||
val field = companionObject.fieldsIndex[fieldName] ?: throw UnexpectedException(expr.text)
|
||||
val receiver = variableManager[companionObject.fullName]!!
|
||||
if (field == null) {
|
||||
throw UnexpectedException("")
|
||||
}
|
||||
val result = codeBuilder.getNewVariable(field!!.type, pointer = 1)
|
||||
val result = codeBuilder.getNewVariable(field.type, pointer = 1)
|
||||
|
||||
codeBuilder.loadClassField(result, receiver, field.offset)
|
||||
return result
|
||||
|
||||
@@ -17,4 +17,7 @@ class LLVMStringType(override val length: Int) : LLVMArray, LLVMType() {
|
||||
override fun basicType() = LLVMCharType()
|
||||
override val typename = "i8*"
|
||||
override fun fullType() = "[${length + 1} x i8]"
|
||||
override fun hashCode(): Int {
|
||||
return length
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user