diff --git a/translator/src/main/kotlin/org/kotlinnative/translator/FunctionCodegen.kt b/translator/src/main/kotlin/org/kotlinnative/translator/FunctionCodegen.kt index 4a35f659b7a..20f37f38da9 100644 --- a/translator/src/main/kotlin/org/kotlinnative/translator/FunctionCodegen.kt +++ b/translator/src/main/kotlin/org/kotlinnative/translator/FunctionCodegen.kt @@ -15,7 +15,7 @@ class FunctionCodegen(override val state: TranslationState, override val variabl BlockCodegen(state, variableManager, codeBuilder) { var name = function.fqName.toString() - var args = ArrayList() + var args = LinkedList() init { val descriptor = state.bindingContext.get(BindingContext.FUNCTION, function)!! @@ -58,7 +58,7 @@ class FunctionCodegen(override val state: TranslationState, override val variabl var external = false if (this_type != null) { - args.add(this_type) + args.addFirst(this_type) } args.forEach { val type = it.type diff --git a/translator/src/test/kotlin/tests/input/class_methods_1.txt b/translator/src/test/kotlin/tests/input/class_methods_1.txt new file mode 100644 index 00000000000..2a1153ba1de --- /dev/null +++ b/translator/src/test/kotlin/tests/input/class_methods_1.txt @@ -0,0 +1 @@ +class_methods_1(55) == 60 \ No newline at end of file diff --git a/translator/src/test/kotlin/tests/kotlin/class_methods_1.kt b/translator/src/test/kotlin/tests/kotlin/class_methods_1.kt new file mode 100644 index 00000000000..e96a4229bf4 --- /dev/null +++ b/translator/src/test/kotlin/tests/kotlin/class_methods_1.kt @@ -0,0 +1,10 @@ +class class_methods_1_class() { + fun method(t : Int): Int { + return t + 5 + } +} + +fun class_methods_1(zz: Int): Int { + val x = class_methods_1_class() + return x.method(zz) +} \ No newline at end of file