translator: fix loading references
This commit is contained in:
@@ -311,7 +311,8 @@ class FunctionCodegen(val state: TranslationState, val variableManager: Variable
|
||||
|
||||
for (arg in args) {
|
||||
val currentExpression = evaluateExpression(arg.getArgumentExpression(), scopeDepth) as LLVMSingleValue
|
||||
result.add(currentExpression)
|
||||
val nativeExpression = codeBuilder.receiveNativeValue(currentExpression)
|
||||
result.add(nativeExpression)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@@ -207,7 +207,7 @@ class LLVMBuilder(val arm: Boolean) {
|
||||
|
||||
fun loadAndGetVariable(source: LLVMVariable): LLVMVariable {
|
||||
assert(source.pointer > 0)
|
||||
val target = getNewVariable(source.type, source.pointer, source.kotlinName)
|
||||
val target = getNewVariable(source.type, source.pointer - 1, source.kotlinName)
|
||||
val code = "$target = load ${source.getType()} $source, align ${target.type.align}"
|
||||
localCode.appendln(code)
|
||||
return target
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
annotation class Native(val type: String = "")
|
||||
|
||||
@Native
|
||||
class classname_A(@Native("i32") val x: Int) {
|
||||
|
||||
class classname_A(val x: Int) {
|
||||
fun method(): Int {
|
||||
return this.x + 5
|
||||
}
|
||||
}
|
||||
|
||||
fun simply_class_1(zz: Int) : Int{
|
||||
fun simply_class_1(zz: Int): Int {
|
||||
val x = classname_A(zz)
|
||||
val r = x.method()
|
||||
return r
|
||||
return x.method()
|
||||
}
|
||||
Reference in New Issue
Block a user