From 995ac7aac231527818f18e182254e62918e5a2d4 Mon Sep 17 00:00:00 2001 From: Anton Bannykh Date: Fri, 12 Oct 2018 15:33:21 +0300 Subject: [PATCH] [JS IR BE]: make `deleteProperty` non-inline due to new inliner limitations --- .../extendJavaCollections/abstractSet.kt | 1 - .../extendJavaCollections/hashMap.kt | 1 - .../extendJavaCollections/hashSet.kt | 1 - .../codegen/box/specialBuiltins/removeSetInt.kt | 1 - .../org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt | 3 ++- .../mutableMapRemoveWithCollision.kt | 1 - libraries/stdlib/js/irRuntime/collectionsHacks.kt | 13 +++++++++++++ 7 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 libraries/stdlib/js/irRuntime/collectionsHacks.kt diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt index 91949f9164b..01e1c3c3b33 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractSet.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE class A : HashSet() diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt index de99c8be0c0..821e6fddc98 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE // IGNORE_BACKEND: JVM_IR class A : HashMap() diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt index 91949f9164b..01e1c3c3b33 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashSet.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: NATIVE class A : HashSet() diff --git a/compiler/testData/codegen/box/specialBuiltins/removeSetInt.kt b/compiler/testData/codegen/box/specialBuiltins/removeSetInt.kt index 3e6ba1c438c..9e08c333c53 100644 --- a/compiler/testData/codegen/box/specialBuiltins/removeSetInt.kt +++ b/compiler/testData/codegen/box/specialBuiltins/removeSetInt.kt @@ -1,6 +1,5 @@ // IGNORE_BACKEND: NATIVE // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR class MySet : HashSet() { override fun remove(element: Int): Boolean { return super.remove(element) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index a7ec89ea920..4f358209b00 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -73,7 +73,8 @@ private val runtimeSourcesCommon = listOfKtFilesFrom( "libraries/stdlib/js/src/kotlin/builtins.kt", // Inlining of js fun doesn't update the variables inside - "libraries/stdlib/js/src/kotlin/jsTypeOf.kt" + "libraries/stdlib/js/src/kotlin/jsTypeOf.kt", + "libraries/stdlib/js/src/kotlin/collections/utils.kt" ) diff --git a/js/js.translator/testData/box/standardClasses/mutableMapRemoveWithCollision.kt b/js/js.translator/testData/box/standardClasses/mutableMapRemoveWithCollision.kt index c1949b307f9..9eea0904dd4 100644 --- a/js/js.translator/testData/box/standardClasses/mutableMapRemoveWithCollision.kt +++ b/js/js.translator/testData/box/standardClasses/mutableMapRemoveWithCollision.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1287 package foo diff --git a/libraries/stdlib/js/irRuntime/collectionsHacks.kt b/libraries/stdlib/js/irRuntime/collectionsHacks.kt new file mode 100644 index 00000000000..7641d3a4924 --- /dev/null +++ b/libraries/stdlib/js/irRuntime/collectionsHacks.kt @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package kotlin.collections + +// Copied from libraries/stdlib/js/src/kotlin/collections/utils.kt +// Current inliner doesn't rename symbols inside `js` fun +@Suppress("UNUSED_PARAMETER") +internal fun deleteProperty(obj: Any, property: Any) { + js("delete obj[property]") +}