diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index ed56381ec68..ba12e7f348a 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -720,96 +720,7 @@ public interface FloatingPointConstants { public abstract fun (): T } -public interface Function0 { - public abstract fun invoke(): R -} - -public interface Function1 { - public abstract fun invoke(/*0*/ p1: P1): R -} - -public interface Function10 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10): R -} - -public interface Function11 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11): R -} - -public interface Function12 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12): R -} - -public interface Function13 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13): R -} - -public interface Function14 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14): R -} - -public interface Function15 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15): R -} - -public interface Function16 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16): R -} - -public interface Function17 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17): R -} - -public interface Function18 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17, /*17*/ p18: P18): R -} - -public interface Function19 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17, /*17*/ p18: P18, /*18*/ p19: P19): R -} - -public interface Function2 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2): R -} - -public interface Function20 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17, /*17*/ p18: P18, /*18*/ p19: P19, /*19*/ p20: P20): R -} - -public interface Function21 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17, /*17*/ p18: P18, /*18*/ p19: P19, /*19*/ p20: P20, /*20*/ p21: P21): R -} - -public interface Function22 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9, /*9*/ p10: P10, /*10*/ p11: P11, /*11*/ p12: P12, /*12*/ p13: P13, /*13*/ p14: P14, /*14*/ p15: P15, /*15*/ p16: P16, /*16*/ p17: P17, /*17*/ p18: P18, /*18*/ p19: P19, /*19*/ p20: P20, /*20*/ p21: P21, /*21*/ p22: P22): R -} - -public interface Function3 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3): R -} - -public interface Function4 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4): R -} - -public interface Function5 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5): R -} - -public interface Function6 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6): R -} - -public interface Function7 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7): R -} - -public interface Function8 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8): R -} - -public interface Function9 { - public abstract fun invoke(/*0*/ p1: P1, /*1*/ p2: P2, /*2*/ p3: P3, /*3*/ p4: P4, /*4*/ p5: P5, /*5*/ p6: P6, /*6*/ p7: P7, /*7*/ p8: P8, /*8*/ p9: P9): R +public interface Function { } public final enum class InlineOption : kotlin.Enum { diff --git a/core/builtins/src/kotlin/reflect/KExtensionFunctions.kt b/core/builtins/src/kotlin/reflect/KExtensionFunctions.kt deleted file mode 100644 index 615644126e1..00000000000 --- a/core/builtins/src/kotlin/reflect/KExtensionFunctions.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Auto-generated file. DO NOT EDIT! - -package kotlin.reflect - -/** An extension function with introspection capabilities that takes 0 arguments. */ -public interface KExtensionFunction0 : ExtensionFunction0 -/** An extension function with introspection capabilities that takes 1 argument. */ -public interface KExtensionFunction1 : ExtensionFunction1 -/** An extension function with introspection capabilities that takes 2 arguments. */ -public interface KExtensionFunction2 : ExtensionFunction2 -/** An extension function with introspection capabilities that takes 3 arguments. */ -public interface KExtensionFunction3 : ExtensionFunction3 -/** An extension function with introspection capabilities that takes 4 arguments. */ -public interface KExtensionFunction4 : ExtensionFunction4 -/** An extension function with introspection capabilities that takes 5 arguments. */ -public interface KExtensionFunction5 : ExtensionFunction5 -/** An extension function with introspection capabilities that takes 6 arguments. */ -public interface KExtensionFunction6 : ExtensionFunction6 -/** An extension function with introspection capabilities that takes 7 arguments. */ -public interface KExtensionFunction7 : ExtensionFunction7 -/** An extension function with introspection capabilities that takes 8 arguments. */ -public interface KExtensionFunction8 : ExtensionFunction8 -/** An extension function with introspection capabilities that takes 9 arguments. */ -public interface KExtensionFunction9 : ExtensionFunction9 -/** An extension function with introspection capabilities that takes 10 arguments. */ -public interface KExtensionFunction10 : ExtensionFunction10 -/** An extension function with introspection capabilities that takes 11 arguments. */ -public interface KExtensionFunction11 : ExtensionFunction11 -/** An extension function with introspection capabilities that takes 12 arguments. */ -public interface KExtensionFunction12 : ExtensionFunction12 -/** An extension function with introspection capabilities that takes 13 arguments. */ -public interface KExtensionFunction13 : ExtensionFunction13 -/** An extension function with introspection capabilities that takes 14 arguments. */ -public interface KExtensionFunction14 : ExtensionFunction14 -/** An extension function with introspection capabilities that takes 15 arguments. */ -public interface KExtensionFunction15 : ExtensionFunction15 -/** An extension function with introspection capabilities that takes 16 arguments. */ -public interface KExtensionFunction16 : ExtensionFunction16 -/** An extension function with introspection capabilities that takes 17 arguments. */ -public interface KExtensionFunction17 : ExtensionFunction17 -/** An extension function with introspection capabilities that takes 18 arguments. */ -public interface KExtensionFunction18 : ExtensionFunction18 -/** An extension function with introspection capabilities that takes 19 arguments. */ -public interface KExtensionFunction19 : ExtensionFunction19 -/** An extension function with introspection capabilities that takes 20 arguments. */ -public interface KExtensionFunction20 : ExtensionFunction20 -/** An extension function with introspection capabilities that takes 21 arguments. */ -public interface KExtensionFunction21 : ExtensionFunction21 -/** An extension function with introspection capabilities that takes 22 arguments. */ -public interface KExtensionFunction22 : ExtensionFunction22 diff --git a/core/builtins/src/kotlin/reflect/KFunctions.kt b/core/builtins/src/kotlin/reflect/KFunctions.kt deleted file mode 100644 index f79c41ae2b4..00000000000 --- a/core/builtins/src/kotlin/reflect/KFunctions.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Auto-generated file. DO NOT EDIT! - -package kotlin.reflect - -/** A function with introspection capabilities that takes 0 arguments. */ -public interface KFunction0 : Function0 -/** A function with introspection capabilities that takes 1 argument. */ -public interface KFunction1 : Function1 -/** A function with introspection capabilities that takes 2 arguments. */ -public interface KFunction2 : Function2 -/** A function with introspection capabilities that takes 3 arguments. */ -public interface KFunction3 : Function3 -/** A function with introspection capabilities that takes 4 arguments. */ -public interface KFunction4 : Function4 -/** A function with introspection capabilities that takes 5 arguments. */ -public interface KFunction5 : Function5 -/** A function with introspection capabilities that takes 6 arguments. */ -public interface KFunction6 : Function6 -/** A function with introspection capabilities that takes 7 arguments. */ -public interface KFunction7 : Function7 -/** A function with introspection capabilities that takes 8 arguments. */ -public interface KFunction8 : Function8 -/** A function with introspection capabilities that takes 9 arguments. */ -public interface KFunction9 : Function9 -/** A function with introspection capabilities that takes 10 arguments. */ -public interface KFunction10 : Function10 -/** A function with introspection capabilities that takes 11 arguments. */ -public interface KFunction11 : Function11 -/** A function with introspection capabilities that takes 12 arguments. */ -public interface KFunction12 : Function12 -/** A function with introspection capabilities that takes 13 arguments. */ -public interface KFunction13 : Function13 -/** A function with introspection capabilities that takes 14 arguments. */ -public interface KFunction14 : Function14 -/** A function with introspection capabilities that takes 15 arguments. */ -public interface KFunction15 : Function15 -/** A function with introspection capabilities that takes 16 arguments. */ -public interface KFunction16 : Function16 -/** A function with introspection capabilities that takes 17 arguments. */ -public interface KFunction17 : Function17 -/** A function with introspection capabilities that takes 18 arguments. */ -public interface KFunction18 : Function18 -/** A function with introspection capabilities that takes 19 arguments. */ -public interface KFunction19 : Function19 -/** A function with introspection capabilities that takes 20 arguments. */ -public interface KFunction20 : Function20 -/** A function with introspection capabilities that takes 21 arguments. */ -public interface KFunction21 : Function21 -/** A function with introspection capabilities that takes 22 arguments. */ -public interface KFunction22 : Function22 diff --git a/core/builtins/src/kotlin/reflect/KMemberFunctions.kt b/core/builtins/src/kotlin/reflect/KMemberFunctions.kt deleted file mode 100644 index 57f7e141423..00000000000 --- a/core/builtins/src/kotlin/reflect/KMemberFunctions.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Auto-generated file. DO NOT EDIT! - -package kotlin.reflect - -/** A member function with introspection capabilities that takes 0 arguments. */ -public interface KMemberFunction0 : ExtensionFunction0 -/** A member function with introspection capabilities that takes 1 argument. */ -public interface KMemberFunction1 : ExtensionFunction1 -/** A member function with introspection capabilities that takes 2 arguments. */ -public interface KMemberFunction2 : ExtensionFunction2 -/** A member function with introspection capabilities that takes 3 arguments. */ -public interface KMemberFunction3 : ExtensionFunction3 -/** A member function with introspection capabilities that takes 4 arguments. */ -public interface KMemberFunction4 : ExtensionFunction4 -/** A member function with introspection capabilities that takes 5 arguments. */ -public interface KMemberFunction5 : ExtensionFunction5 -/** A member function with introspection capabilities that takes 6 arguments. */ -public interface KMemberFunction6 : ExtensionFunction6 -/** A member function with introspection capabilities that takes 7 arguments. */ -public interface KMemberFunction7 : ExtensionFunction7 -/** A member function with introspection capabilities that takes 8 arguments. */ -public interface KMemberFunction8 : ExtensionFunction8 -/** A member function with introspection capabilities that takes 9 arguments. */ -public interface KMemberFunction9 : ExtensionFunction9 -/** A member function with introspection capabilities that takes 10 arguments. */ -public interface KMemberFunction10 : ExtensionFunction10 -/** A member function with introspection capabilities that takes 11 arguments. */ -public interface KMemberFunction11 : ExtensionFunction11 -/** A member function with introspection capabilities that takes 12 arguments. */ -public interface KMemberFunction12 : ExtensionFunction12 -/** A member function with introspection capabilities that takes 13 arguments. */ -public interface KMemberFunction13 : ExtensionFunction13 -/** A member function with introspection capabilities that takes 14 arguments. */ -public interface KMemberFunction14 : ExtensionFunction14 -/** A member function with introspection capabilities that takes 15 arguments. */ -public interface KMemberFunction15 : ExtensionFunction15 -/** A member function with introspection capabilities that takes 16 arguments. */ -public interface KMemberFunction16 : ExtensionFunction16 -/** A member function with introspection capabilities that takes 17 arguments. */ -public interface KMemberFunction17 : ExtensionFunction17 -/** A member function with introspection capabilities that takes 18 arguments. */ -public interface KMemberFunction18 : ExtensionFunction18 -/** A member function with introspection capabilities that takes 19 arguments. */ -public interface KMemberFunction19 : ExtensionFunction19 -/** A member function with introspection capabilities that takes 20 arguments. */ -public interface KMemberFunction20 : ExtensionFunction20 -/** A member function with introspection capabilities that takes 21 arguments. */ -public interface KMemberFunction21 : ExtensionFunction21 -/** A member function with introspection capabilities that takes 22 arguments. */ -public interface KMemberFunction22 : ExtensionFunction22 diff --git a/core/builtins/src/kotlin/Functions.kt b/core/runtime.jvm/src/kotlin/jvm/functions/Functions.kt similarity index 99% rename from core/builtins/src/kotlin/Functions.kt rename to core/runtime.jvm/src/kotlin/jvm/functions/Functions.kt index 5fbbf8e60ff..8d7174c2c35 100644 --- a/core/builtins/src/kotlin/Functions.kt +++ b/core/runtime.jvm/src/kotlin/jvm/functions/Functions.kt @@ -16,7 +16,7 @@ // Auto-generated file. DO NOT EDIT! -package kotlin +package kotlin.jvm.functions /** A function that takes 0 arguments. */ public interface Function0 : Function { diff --git a/generators/src/org/jetbrains/kotlin/generators/builtins/functions.kt b/generators/src/org/jetbrains/kotlin/generators/builtins/functions.kt index 1b33a42da90..16bde8d463b 100644 --- a/generators/src/org/jetbrains/kotlin/generators/builtins/functions.kt +++ b/generators/src/org/jetbrains/kotlin/generators/builtins/functions.kt @@ -16,35 +16,28 @@ package org.jetbrains.kotlin.generators.builtins.functions -import org.jetbrains.kotlin.generators.builtins.functions.FunctionKind.* import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator import java.io.PrintWriter val MAX_PARAM_COUNT = 22 enum class FunctionKind( - private val classNamePrefix: String, + val classFqNamePrefix: String, val docPrefix: String, - val hasReceiverParameter: Boolean, - private val superClassNamePrefix: String? + val hasReceiverParameter: Boolean ) { - FUNCTION("Function", "A function", false, null), - EXTENSION_FUNCTION("ExtensionFunction", "An extension function", true, null), + FUNCTION : FunctionKind("kotlin.jvm.functions.Function", "A function", false) + EXTENSION_FUNCTION : FunctionKind("kotlin.ExtensionFunction", "An extension function", true) - K_FUNCTION("KFunction", "A function with introspection capabilities", false, "Function"), - K_MEMBER_FUNCTION("KMemberFunction", "A member function with introspection capabilities", true, "ExtensionFunction"), - K_EXTENSION_FUNCTION("KExtensionFunction", "An extension function with introspection capabilities", true, "ExtensionFunction"); + val classNamePrefix: String get() = classFqNamePrefix.substringAfterLast('.') + val packageFqName: String get() = classFqNamePrefix.substringBeforeLast('.') + val fileName: String get() = classFqNamePrefix.replace('.', '/') + "s.kt" - fun getFileName() = (if (isReflection()) "reflect/" else "") + classNamePrefix + "s.kt" fun getClassName(i: Int) = classNamePrefix + i - fun getSuperClassName(i: Int) = superClassNamePrefix?.plus(i) - fun getPackage() = if (isReflection()) "kotlin.reflect" else "kotlin" - - fun isReflection() = name() startsWith "K" } class GenerateFunctions(out: PrintWriter, val kind: FunctionKind) : BuiltInsSourceGenerator(out) { - override fun getPackage() = kind.getPackage() + override fun getPackage() = kind.packageFqName fun generateTypeParameters(i: Int, variance: Boolean) { out.print("<") @@ -73,7 +66,7 @@ class GenerateFunctions(out: PrintWriter, val kind: FunctionKind) : BuiltInsSour generateDocumentation(i) out.print("public interface " + kind.getClassName(i)) generateTypeParameters(i, variance = true) - generateSuperClass(i) + generateSuperClass() generateFunctionClassBody(i) } } @@ -83,28 +76,16 @@ class GenerateFunctions(out: PrintWriter, val kind: FunctionKind) : BuiltInsSour out.println("/** ${kind.docPrefix} that takes $i argument${suffix}. */") } - fun generateSuperClass(i: Int) { - val superClass = kind.getSuperClassName(i) - if (superClass != null) { - out.print(" : $superClass") - generateTypeParameters(i, variance = false) - } - else { - out.print(" : Function<") - generateReturnTypeParameter(variance = false) - out.print(">") - } + fun generateSuperClass() { + out.print(" : Function<") + generateReturnTypeParameter(variance = false) + out.print(">") } - fun generateFunctionClassBody(i: Int): Unit = when (kind) { - FUNCTION, EXTENSION_FUNCTION -> { - out.println(" {") - generateInvokeSignature(i) - out.println("}") - } - K_FUNCTION, K_MEMBER_FUNCTION, K_EXTENSION_FUNCTION -> { - out.println() - } + fun generateFunctionClassBody(i: Int) { + out.println(" {") + generateInvokeSignature(i) + out.println("}") } fun generateInvokeSignature(i: Int) { diff --git a/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt b/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt index cb14dbbdb26..d93cb433828 100644 --- a/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt +++ b/generators/src/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt @@ -31,9 +31,9 @@ import java.io.PrintWriter fun assertExists(file: File): Unit = if (!file.exists()) error("Output dir does not exist: ${file.getAbsolutePath()}") -val BUILT_INS_NATIVE_DIR = File("core/builtins/native/kotlin/") -val BUILT_INS_SRC_DIR = File("core/builtins/src/kotlin/") -val RUNTIME_JVM_DIR = File("core/runtime.jvm/src/kotlin/") +val BUILT_INS_NATIVE_DIR = File("core/builtins/native/") +val BUILT_INS_SRC_DIR = File("core/builtins/src/") +val RUNTIME_JVM_DIR = File("core/runtime.jvm/src/") abstract class BuiltInsSourceGenerator(val out: PrintWriter) { protected abstract fun generateBody(): Unit @@ -59,16 +59,17 @@ fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) assertExists(RUNTIME_JVM_DIR) for (kind in FunctionKind.values()) { - generate(File(BUILT_INS_SRC_DIR, kind.getFileName())) { GenerateFunctions(it, kind) } + val dir = if (kind == FunctionKind.FUNCTION) RUNTIME_JVM_DIR else BUILT_INS_SRC_DIR + generate(File(dir, kind.fileName)) { GenerateFunctions(it, kind) } } - generate(File(BUILT_INS_NATIVE_DIR, "Arrays.kt")) { GenerateArrays(it) } - generate(File(BUILT_INS_NATIVE_DIR, "Primitives.kt")) { GeneratePrimitives(it) } - generate(File(BUILT_INS_SRC_DIR, "Iterators.kt")) { GenerateIterators(it) } - generate(File(RUNTIME_JVM_DIR, "jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) } - generate(File(BUILT_INS_SRC_DIR, "ProgressionIterators.kt")) { GenerateProgressionIterators(it) } - generate(File(BUILT_INS_SRC_DIR, "Progressions.kt")) { GenerateProgressions(it) } - generate(File(BUILT_INS_SRC_DIR, "Ranges.kt")) { GenerateRanges(it) } + generate(File(BUILT_INS_NATIVE_DIR, "kotlin/Arrays.kt")) { GenerateArrays(it) } + generate(File(BUILT_INS_NATIVE_DIR, "kotlin/Primitives.kt")) { GeneratePrimitives(it) } + generate(File(BUILT_INS_SRC_DIR, "kotlin/Iterators.kt")) { GenerateIterators(it) } + generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) } + generate(File(BUILT_INS_SRC_DIR, "kotlin/ProgressionIterators.kt")) { GenerateProgressionIterators(it) } + generate(File(BUILT_INS_SRC_DIR, "kotlin/Progressions.kt")) { GenerateProgressions(it) } + generate(File(BUILT_INS_SRC_DIR, "kotlin/Ranges.kt")) { GenerateRanges(it) } } fun main(args: Array) { diff --git a/jslib_files.xml b/jslib_files.xml index 32baa630167..ba89c65595f 100644 --- a/jslib_files.xml +++ b/jslib_files.xml @@ -4,7 +4,6 @@ -