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) {
|
for (arg in args) {
|
||||||
val currentExpression = evaluateExpression(arg.getArgumentExpression(), scopeDepth) as LLVMSingleValue
|
val currentExpression = evaluateExpression(arg.getArgumentExpression(), scopeDepth) as LLVMSingleValue
|
||||||
result.add(currentExpression)
|
val nativeExpression = codeBuilder.receiveNativeValue(currentExpression)
|
||||||
|
result.add(nativeExpression)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class LLVMBuilder(val arm: Boolean) {
|
|||||||
|
|
||||||
fun loadAndGetVariable(source: LLVMVariable): LLVMVariable {
|
fun loadAndGetVariable(source: LLVMVariable): LLVMVariable {
|
||||||
assert(source.pointer > 0)
|
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}"
|
val code = "$target = load ${source.getType()} $source, align ${target.type.align}"
|
||||||
localCode.appendln(code)
|
localCode.appendln(code)
|
||||||
return target
|
return target
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
annotation class Native(val type: String = "")
|
class classname_A(val x: Int) {
|
||||||
|
|
||||||
@Native
|
|
||||||
class classname_A(@Native("i32") val x: Int) {
|
|
||||||
|
|
||||||
fun method(): Int {
|
fun method(): Int {
|
||||||
return this.x + 5
|
return this.x + 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun simply_class_1(zz: Int) : Int{
|
fun simply_class_1(zz: Int): Int {
|
||||||
val x = classname_A(zz)
|
val x = classname_A(zz)
|
||||||
val r = x.method()
|
return x.method()
|
||||||
return r
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user