diff --git a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArgumentsCopyGenerated.kt b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArgumentsCopyGenerated.kt index aa4450dc6d5..93724f13e1a 100644 --- a/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArgumentsCopyGenerated.kt +++ b/compiler/cli/cli-common/gen/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArgumentsCopyGenerated.kt @@ -48,6 +48,7 @@ fun copyK2JSCompilerArguments(from: K2JSCompilerArguments, to: K2JSCompilerArgum to.moduleKind = from.moduleKind to.moduleName = from.moduleName to.noStdlib = from.noStdlib + to.optimizeGeneratedJs = from.optimizeGeneratedJs to.outputDir = from.outputDir to.outputFile = from.outputFile to.outputPostfix = from.outputPostfix diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index 0c87472437a..6b096cdb8a9 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -605,6 +605,16 @@ class K2JSCompilerArguments : CommonCompilerArguments() { field = value } + @Argument( + value = "-Xoptimize-generated-js", + description = "Perform additional optimizations on the generated JS code" + ) + var optimizeGeneratedJs = true + set(value) { + checkFrozen() + field = value + } + private fun MessageCollector.deprecationWarn(value: Boolean, defaultValue: Boolean, name: String) { if (value != defaultValue) { report(CompilerMessageSeverity.WARNING, "'$name' is deprecated and ignored, it will be removed in a future release") diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index 14bacea259f..f4fd4064f50 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -175,6 +175,7 @@ class K2JsIrCompiler : CLICompiler() { configuration.put(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS, arguments.wasmEnableArrayRangeChecks) configuration.put(JSConfigurationKeys.WASM_ENABLE_ASSERTS, arguments.wasmEnableAsserts) configuration.put(JSConfigurationKeys.WASM_GENERATE_WAT, arguments.wasmGenerateWat) + configuration.put(JSConfigurationKeys.OPTIMIZE_GENERATED_JS, arguments.optimizeGeneratedJs) val commonSourcesArray = arguments.commonSources val commonSources = commonSourcesArray?.toSet() ?: emptySet() diff --git a/compiler/ir/backend.js/build.gradle.kts b/compiler/ir/backend.js/build.gradle.kts index a56b8b4d7db..11caa4ada3d 100644 --- a/compiler/ir/backend.js/build.gradle.kts +++ b/compiler/ir/backend.js/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { api(project(":js:js.ast")) api(project(":js:js.frontend")) api(project(":js:js.sourcemap")) + implementation(project(":js:js.translator")) compileOnly(intellijCore()) } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/HashCalculatorForIC.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/HashCalculatorForIC.kt index 6784c656d85..d41aa65f462 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/HashCalculatorForIC.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/HashCalculatorForIC.kt @@ -95,7 +95,8 @@ internal class ICHasher { val importantSettings = listOf( JSConfigurationKeys.GENERATE_DTS, JSConfigurationKeys.MODULE_KIND, - JSConfigurationKeys.PROPERTY_LAZY_INITIALIZATION + JSConfigurationKeys.PROPERTY_LAZY_INITIALIZATION, + JSConfigurationKeys.OPTIMIZE_GENERATED_JS ) hashCalculator.updateForEach(importantSettings) { key -> hashCalculator.update(key.toString()) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/optimizations.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/optimizations.kt index d6bb84fb2cc..f8b94970ea4 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/optimizations.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/optimizations.kt @@ -8,7 +8,11 @@ package org.jetbrains.kotlin.ir.backend.js import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig import org.jetbrains.kotlin.backend.common.phaser.invokeToplevel import org.jetbrains.kotlin.ir.backend.js.dce.eliminateDeadDeclarations +import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.JsIrProgramFragment import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.js.backend.ast.JsFunction +import org.jetbrains.kotlin.js.backend.ast.RecursiveJsVisitor +import org.jetbrains.kotlin.js.inline.clean.FunctionPostProcessor fun optimizeProgramByIr( modules: Iterable, @@ -17,4 +21,14 @@ fun optimizeProgramByIr( ) { eliminateDeadDeclarations(modules, context, removeUnusedAssociatedObjects) jsOptimizationPhases.invokeToplevel(PhaseConfig(jsOptimizationPhases), context, modules) -} \ No newline at end of file +} + +fun optimizeFragmentByJsAst(fragment: JsIrProgramFragment) { + fragment.declarations.statements.forEach { + it.accept(object : RecursiveJsVisitor() { + override fun visitFunction(x: JsFunction) { + FunctionPostProcessor(x).apply() + } + }) + } +} diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt index da309ca8d61..6316091e7a6 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsExpressionTransformer.kt @@ -7,15 +7,20 @@ package org.jetbrains.kotlin.ir.backend.js.transformers.irToJs import org.jetbrains.kotlin.backend.common.compilationException import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.ir.backend.js.JsStatementOrigins import org.jetbrains.kotlin.ir.backend.js.utils.JsGenerationContext import org.jetbrains.kotlin.ir.backend.js.utils.Namer import org.jetbrains.kotlin.ir.backend.js.utils.getJsNameOrKotlinName +import org.jetbrains.kotlin.ir.backend.js.utils.isUnitInstanceFunction import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.types.isString import org.jetbrains.kotlin.ir.types.isUnit import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.js.backend.ast.* +import org.jetbrains.kotlin.js.backend.ast.metadata.SideEffectKind +import org.jetbrains.kotlin.js.backend.ast.metadata.sideEffects +import org.jetbrains.kotlin.js.backend.ast.metadata.synthetic @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE") class IrElementToJsExpressionTransformer : BaseIrElementToJsNodeTransformer { @@ -23,6 +28,12 @@ class IrElementToJsExpressionTransformer : BaseIrElementToJsNodeTransformer, data: JsGenerationContext): JsExpression { + return super.visitMemberAccess(expression, data).apply { + synthetic = expression.origin == JsStatementOrigins.SYNTHESIZED_STATEMENT + } + } + override fun visitComposite(expression: IrComposite, data: JsGenerationContext): JsExpression { val size = expression.statements.size if (size == 0) TODO("Empty IrComposite is not supported") diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt index 7cdc8ee1817..d5f1ccd0781 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt @@ -11,6 +11,8 @@ import org.jetbrains.kotlin.ir.backend.js.JsLoweredDeclarationOrigin import org.jetbrains.kotlin.ir.backend.js.utils.JsGenerationContext import org.jetbrains.kotlin.ir.backend.js.utils.emptyScope import org.jetbrains.kotlin.ir.backend.js.utils.isTheLastReturnStatementIn +import org.jetbrains.kotlin.ir.backend.js.utils.isUnitInstanceFunction +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrFunction import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrVariable @@ -24,6 +26,7 @@ import org.jetbrains.kotlin.ir.util.file import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.js.backend.ast.* +import org.jetbrains.kotlin.js.backend.ast.metadata.synthetic @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE") class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer { @@ -161,7 +164,19 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer true + is IrDeclarationOrigin.IR_TEMPORARY_VARIABLE_FOR_INLINED_PARAMETER -> true + is IrDeclarationOrigin.IR_TEMPORARY_VARIABLE_FOR_INLINED_EXTENSION_RECEIVER -> true + else -> false + } + + val variable = JsVars.JsVar(varName, jsInitializer).apply { + withSource(declaration, context, useNameOf = declaration) + synthetic = syntheticVariable + } + return JsVars(variable).apply { synthetic = syntheticVariable } } override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, context: JsGenerationContext): JsStatement { @@ -172,7 +187,7 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer().firstOrNull { it.isInstantiableEnum } +fun IrFunctionSymbol.isUnitInstanceFunction(context: JsIrBackendContext): Boolean { + return owner.origin === JsLoweredDeclarationOrigin.OBJECT_GET_INSTANCE_FUNCTION && + owner.returnType.classifierOrNull === context.irBuiltIns.unitClass +} + // TODO: the code is written to pass Repl tests, so we should understand. why in Repl tests we don't have backingField fun JsIrBackendContext.getVoid(): IrExpression = intrinsics.void.owner.backingField?.let { diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/JsGenerationContext.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/JsGenerationContext.kt index 0dfa3ead5dc..fbaa0f49a0d 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/JsGenerationContext.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/utils/JsGenerationContext.kt @@ -81,7 +81,7 @@ class JsGenerationContext( fun getNameForReturnableBlock(block: IrReturnableBlock): JsName? { return nameCache.getOrPut(block) { val name = localNames!!.localReturnableBlockNames.names[block] ?: return null - return JsName(name, true) + JsName(name, true) } } diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 1a5ba86e7ad..e7c25625824 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -40,6 +40,7 @@ where advanced options include: -Xir-safe-external-boolean-diagnostic={log|exception} Enable runtime diagnostics when access safely to boolean in external declarations -Xmetadata-only Generate *.meta.js and *.kjsm files only + -Xoptimize-generated-js Perform additional optimizations on the generated JS code -Xpartial-linkage-loglevel={info|warning|error} Partial linkage compile-time log level -Xpartial-linkage={enable|disable} diff --git a/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt b/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt index 5e9b30a7ed2..77d89cd6ff3 100644 --- a/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt +++ b/compiler/testData/codegen/box/when/switchOptimizationSingleStatementCase.kt @@ -1,15 +1,14 @@ // CHECK_CASES_COUNT: function=test1 count=2 TARGET_BACKENDS=JS // CHECK_CASES_COUNT: function=test1 count=0 IGNORED_BACKENDS=JS -// CHECK_IF_COUNT: function=test1 count=0 TARGET_BACKENDS=JS -// CHECK_IF_COUNT: function=test1 count=1 IGNORED_BACKENDS=JS // CHECK_BREAKS_COUNT: function=test1 count=1 TARGET_BACKENDS=JS // CHECK_BREAKS_COUNT: function=test1 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=test1 count=0 // CHECK_CASES_COUNT: function=test2 count=2 TARGET_BACKENDS=JS // CHECK_CASES_COUNT: function=test2 count=0 IGNORED_BACKENDS=JS -// CHECK_IF_COUNT: function=test2 count=0 TARGET_BACKENDS=JS -// CHECK_IF_COUNT: function=test2 count=1 IGNORED_BACKENDS=JS -// CHECK_BREAKS_COUNT: function=test2 count=1 +// CHECK_BREAKS_COUNT: function=test2 count=1 TARGET_BACKENDS=JS +// CHECK_BREAKS_COUNT: function=test2 count=0 IGNORED_BACKENDS=JS +// CHECK_IF_COUNT: function=test2 count=0 fun test1(v: Int) { when (v) { diff --git a/compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt b/compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt index dce6cc3f7c8..c4c06e62072 100644 --- a/compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt +++ b/compiler/testData/codegen/boxInline/callableReference/kt15751_2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS // WITH_STDLIB // NO_CHECK_LAMBDA_INLINING // KJS_WITH_FULL_RUNTIME diff --git a/compiler/testData/debug/localVariables/catchClause.kt b/compiler/testData/debug/localVariables/catchClause.kt index 4e91ae77141..9a5b36e7e10 100644 --- a/compiler/testData/debug/localVariables/catchClause.kt +++ b/compiler/testData/debug/localVariables/catchClause.kt @@ -22,7 +22,6 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:4 box: // test.kt:5 box: a=1:number -// test.kt:5 box: a=1:number // test.kt:6 box: a=0:number // test.kt:7 box: a=0:number // test.kt:8 box: a=0:number diff --git a/compiler/testData/debug/localVariables/destructuring/assignment.kt b/compiler/testData/debug/localVariables/destructuring/assignment.kt index fc93d48edbe..44f8d2450f6 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignment.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignment.kt @@ -17,6 +17,5 @@ fun box(): String { // EXPECTATIONS JS_IR // test.kt:5 box: // test.kt:7 box: p=kotlin.Pair -// test.kt:7 box: p=kotlin.Pair // test.kt:7 box: p=kotlin.Pair, o="O":kotlin.String // test.kt:9 box: p=kotlin.Pair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt index 906769f5212..5b6ddd26491 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt @@ -36,7 +36,6 @@ fun box(): String { // test.kt:2 : x="X":kotlin.String, y="Y":kotlin.String // test.kt:2 : x="X":kotlin.String, y="Y":kotlin.String // test.kt:14 box: p=MyPair -// test.kt:14 box: p=MyPair // test.kt:4 component1: // test.kt:14 box: p=MyPair, o="O":kotlin.String // test.kt:8 component2: diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt index a632541d5f1..c3e9c4e0859 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt @@ -44,7 +44,6 @@ fun box(): String { // test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String // test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String // test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String -// test.kt:23 box: p=MyPair // test.kt:18 box: p=MyPair // test.kt:6 component1: // test.kt:20 box: p=MyPair, o="O":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt index 54c56b7c59b..794b2d46b2f 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt @@ -30,7 +30,6 @@ fun box(): String { // EXPECTATIONS JS_IR // test.kt:6 box: -// test.kt:15 box: p=kotlin.Pair // test.kt:10 box: p=kotlin.Pair // test.kt:12 box: p=kotlin.Pair, o="O":kotlin.String // test.kt:17 box: p=kotlin.Pair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt index 3c9fe80c9da..fb337e4a668 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt @@ -17,6 +17,5 @@ fun box(): String { // EXPECTATIONS JS_IR // test.kt:5 box: // test.kt:7 box: p=kotlin.Triple -// test.kt:7 box: p=kotlin.Triple // test.kt:7 box: p=kotlin.Triple, o="O":kotlin.String // test.kt:9 box: p=kotlin.Triple, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt index a116e4d712b..3e53e8804f1 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt @@ -32,7 +32,6 @@ fun box(): String { // EXPECTATIONS JS_IR // test.kt:6 box: -// test.kt:17 box: p=kotlin.Triple // test.kt:12 box: p=kotlin.Triple // test.kt:14 box: p=kotlin.Triple, o="O":kotlin.String // test.kt:19 box: p=kotlin.Triple, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/forLoop.kt b/compiler/testData/debug/localVariables/destructuring/forLoop.kt index c35c012a753..aa02ad94c08 100644 --- a/compiler/testData/debug/localVariables/destructuring/forLoop.kt +++ b/compiler/testData/debug/localVariables/destructuring/forLoop.kt @@ -20,9 +20,6 @@ fun box() { // test.kt:5 box: // test.kt:6 box: map=kotlin.collections.HashMap // test.kt:6 box: map=kotlin.collections.HashMap -// test.kt:6 box: map=kotlin.collections.HashMap -// test.kt:6 box: map=kotlin.collections.HashMap -// test.kt:6 box: map=kotlin.collections.HashMap, a="1":kotlin.String // test.kt:7 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String // test.kt:6 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String // test.kt:9 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt b/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt index a07f1c0c6f2..dca8e5db65f 100644 --- a/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt @@ -43,9 +43,6 @@ fun box() { // test.kt:5 box: // test.kt:15 box: map=kotlin.collections.HashMap // test.kt:15 box: map=kotlin.collections.HashMap -// test.kt:15 box: map=kotlin.collections.HashMap -// test.kt:10 box: map=kotlin.collections.HashMap -// test.kt:12 box: map=kotlin.collections.HashMap, a="1":kotlin.String // test.kt:18 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String // test.kt:15 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String -// test.kt:20 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String \ No newline at end of file +// test.kt:20 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String diff --git a/compiler/testData/debug/localVariables/forLoopMultiline.kt b/compiler/testData/debug/localVariables/forLoopMultiline.kt index a1948dc0a0b..209cfe342cc 100644 --- a/compiler/testData/debug/localVariables/forLoopMultiline.kt +++ b/compiler/testData/debug/localVariables/forLoopMultiline.kt @@ -36,8 +36,7 @@ fun box() { // test.kt:5 box: // test.kt:11 box: map=kotlin.collections.HashMap // test.kt:11 box: map=kotlin.collections.HashMap -// test.kt:11 box: map=kotlin.collections.HashMap // test.kt:14 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry // test.kt:14 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry // test.kt:11 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry -// test.kt:16 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry \ No newline at end of file +// test.kt:16 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry diff --git a/compiler/testData/debug/localVariables/inlineProperty.kt b/compiler/testData/debug/localVariables/inlineProperty.kt index a4b7d03c317..789d99704c5 100644 --- a/compiler/testData/debug/localVariables/inlineProperty.kt +++ b/compiler/testData/debug/localVariables/inlineProperty.kt @@ -24,7 +24,5 @@ fun box() { // test.kt:8 box: // test.kt:2 : // test.kt:4 box: a=A -// test.kt:9 box: a=A -// test.kt:10 box: a=A, y=1:number // test.kt:10 box: a=A, y=1:number // test.kt:11 box: a=A, y=2:number diff --git a/compiler/testData/debug/localVariables/jsCode.kt b/compiler/testData/debug/localVariables/jsCode.kt index c054b18525e..5e63521cef0 100644 --- a/compiler/testData/debug/localVariables/jsCode.kt +++ b/compiler/testData/debug/localVariables/jsCode.kt @@ -81,8 +81,7 @@ fun box() { // a.kt:6 exclamate: s="Jesse":kotlin.String // test.kt:52 box: jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String // a.kt:6 exclamate: s="Jesse!":kotlin.String -// a.kt:29 box: jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String // a.kt:22 value: // test.kt:63 box: jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String // test.kt:59 localFun: hello="hello":kotlin.String, world="world":kotlin.String -// test.kt:64 box: jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String \ No newline at end of file +// test.kt:64 box: jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt index e11ddb0cc5f..ee1e917259c 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt @@ -18,7 +18,7 @@ suspend fun box() { // test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JS_IR -// test.kt:9 box: $completion=EmptyContinuation +// test.kt:10 box: $completion=EmptyContinuation // test.kt:4 : // test.kt:9 box: $completion=EmptyContinuation // test.kt:5 foo: $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt index dad0c88650d..0e6b007d3eb 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt @@ -31,7 +31,7 @@ suspend fun box() { // test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JS_IR -// test.kt:14 box: $completion=EmptyContinuation +// test.kt:15 box: $completion=EmptyContinuation // test.kt:4 : // test.kt:14 box: $completion=EmptyContinuation // test.kt:14 box: $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt index 1da33af3d7b..f0c5c5bcda7 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt @@ -19,7 +19,7 @@ suspend fun box() { // test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JS_IR -// test.kt:9 box: $completion=EmptyContinuation +// test.kt:10 box: $completion=EmptyContinuation // test.kt:4 : // test.kt:9 box: $completion=EmptyContinuation // test.kt:6 foo: =A, $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt index 03d87635249..4b8499158f4 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt @@ -27,7 +27,7 @@ suspend fun box() { // test.kt:13 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JS_IR -// test.kt:12 box: $completion=EmptyContinuation +// test.kt:13 box: $completion=EmptyContinuation // test.kt:12 box: $completion=EmptyContinuation // test.kt:6 doResume: // test.kt:4 foo: $completion=$foo1COROUTINE$0 diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt index d3486ff40bd..027608ce806 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt @@ -33,7 +33,7 @@ suspend fun box() { // test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JS_IR -// test.kt:14 box: $completion=EmptyContinuation +// test.kt:15 box: $completion=EmptyContinuation // test.kt:4 : // test.kt:14 box: $completion=EmptyContinuation // test.kt:14 box: $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index e2c19d86a36..373a09bc93f 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -42,7 +42,7 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> // EXPECTATIONS JS_IR // test.kt:12 box: $completion=EmptyContinuation // test.kt:4 : -// test.kt:12 box: $completion=EmptyContinuation +// test.kt:14 box: $completion=EmptyContinuation // test.kt:12 box$slambda: // test.kt:12 box: $completion=EmptyContinuation // test.kt:10 foo: a=A, block=Function2, $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/tryFinally10.kt b/compiler/testData/debug/localVariables/tryFinally10.kt index ad0f05d9149..5cc5c5a9c60 100644 --- a/compiler/testData/debug/localVariables/tryFinally10.kt +++ b/compiler/testData/debug/localVariables/tryFinally10.kt @@ -66,7 +66,6 @@ fun box() { // test.kt:9 compute: y=42:number, i=0:number, z=32:number // test.kt:9 compute: y=42:number, i=0:number, z=32:number // test.kt:9 compute: y=42:number, i=0:number, z=32:number, j=0:number -// test.kt:10 compute: y=42:number, i=0:number, z=32:number, j=0:number // test.kt:24 compute: y=42:number, i=0:number, z=32:number, j=0:number // test.kt:28 compute: y=42:number, i=0:number, z=32:number, j=0:number // test.kt:29 compute: y=42:number, i=0:number, z=32:number, j=0:number, s2="OK":kotlin.String diff --git a/compiler/testData/debug/localVariables/underscoreNames.kt b/compiler/testData/debug/localVariables/underscoreNames.kt index c6ad6d4078f..cac7358ffce 100644 --- a/compiler/testData/debug/localVariables/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/underscoreNames.kt @@ -66,9 +66,6 @@ fun box() { // test.kt:8 : // test.kt:8 : // test.kt:8 : -// test.kt:8 : -// test.kt:8 : -// test.kt:8 : // test.kt:4 : x=1:number // test.kt:4 : x=1:number, y="":kotlin.String // test.kt:4 : x=1:number, y="":kotlin.String, z=48:number @@ -78,7 +75,6 @@ fun box() { // test.kt:8 : // test.kt:8 : // test.kt:8 : -// test.kt:8 : // test.kt:12 box: // test.kt:4 : x=1:number // test.kt:4 : x=1:number, y="":kotlin.String diff --git a/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt b/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt index 13649742295..5ee565b7cff 100644 --- a/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt +++ b/compiler/testData/debug/stepping/beforeGotoToWhileStart.kt @@ -37,12 +37,9 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:19 box -// test.kt:12 foo // test.kt:6 alternate // test.kt:7 alternate -// test.kt:12 foo // test.kt:6 alternate // test.kt:7 alternate -// test.kt:13 foo // test.kt:16 foo -// test.kt:20 box \ No newline at end of file +// test.kt:20 box diff --git a/compiler/testData/debug/stepping/callWithReceiver.kt b/compiler/testData/debug/stepping/callWithReceiver.kt index b8ca5d5cf01..0916e46b7e9 100644 --- a/compiler/testData/debug/stepping/callWithReceiver.kt +++ b/compiler/testData/debug/stepping/callWithReceiver.kt @@ -32,5 +32,4 @@ fun box() { // test.kt:3 // test.kt:11 box // test.kt:4 foo -// test.kt:5 box -// test.kt:15 box \ No newline at end of file +// test.kt:15 box diff --git a/compiler/testData/debug/stepping/chainCall.kt b/compiler/testData/debug/stepping/chainCall.kt index 849baa49d31..c0d643dcb4f 100644 --- a/compiler/testData/debug/stepping/chainCall.kt +++ b/compiler/testData/debug/stepping/chainCall.kt @@ -36,7 +36,4 @@ fun box() { // test.kt:4 foo // test.kt:11 box // test.kt:4 foo -// test.kt:5 box -// test.kt:13 box -// test.kt:5 box -// test.kt:15 box \ No newline at end of file +// test.kt:15 box diff --git a/compiler/testData/debug/stepping/dataClass.kt b/compiler/testData/debug/stepping/dataClass.kt index f7da0236268..bdaba76a025 100644 --- a/compiler/testData/debug/stepping/dataClass.kt +++ b/compiler/testData/debug/stepping/dataClass.kt @@ -82,7 +82,6 @@ fun box() { // test.kt:16 box // test.kt:1 toString // test.kt:17 box -// test.kt:17 box // test.kt:1 component1 // test.kt:17 box // test.kt:1 component2 @@ -108,7 +107,6 @@ fun box() { // test.kt:22 box // test.kt:6 toString // test.kt:23 box -// test.kt:23 box // test.kt:1 component1 // test.kt:23 box // test.kt:1 component2 @@ -117,4 +115,4 @@ fun box() { // test.kt:5 // test.kt:5 // test.kt:5 -// test.kt:25 box \ No newline at end of file +// test.kt:25 box diff --git a/compiler/testData/debug/stepping/if.kt b/compiler/testData/debug/stepping/if.kt index 861ba9c5ca4..a2d4eef70fd 100644 --- a/compiler/testData/debug/stepping/if.kt +++ b/compiler/testData/debug/stepping/if.kt @@ -25,7 +25,6 @@ inline fun getB(): Int { // test.kt:8 box // EXPECTATIONS JS_IR -// test.kt:14 box // test.kt:4 box // test.kt:11 getA -// test.kt:14 box +// test.kt:8 box diff --git a/compiler/testData/debug/stepping/if2.kt b/compiler/testData/debug/stepping/if2.kt index efde4b025b2..97fbf2a410f 100644 --- a/compiler/testData/debug/stepping/if2.kt +++ b/compiler/testData/debug/stepping/if2.kt @@ -40,13 +40,7 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:20 box -// test.kt:4 foo -// test.kt:8 foo -// test.kt:12 foo // test.kt:17 foo // test.kt:21 box -// test.kt:4 foo -// test.kt:8 foo -// test.kt:12 foo // test.kt:17 foo -// test.kt:22 box \ No newline at end of file +// test.kt:22 box diff --git a/compiler/testData/debug/stepping/ifWithInlineInCondition.kt b/compiler/testData/debug/stepping/ifWithInlineInCondition.kt index a051978baf0..ca2f728dcb9 100644 --- a/compiler/testData/debug/stepping/ifWithInlineInCondition.kt +++ b/compiler/testData/debug/stepping/ifWithInlineInCondition.kt @@ -56,23 +56,12 @@ fun nop() {} // test.kt:21 box // EXPECTATIONS JS_IR -// test.kt:24 box -// test.kt:3 box // test.kt:4 box // test.kt:30 nop // test.kt:24 box -// test.kt:8 box -// test.kt:28 box -// test.kt:8 box -// test.kt:24 box -// test.kt:9 box // test.kt:7 box // test.kt:11 box // test.kt:30 nop -// test.kt:24 box -// test.kt:16 box -// test.kt:27 box -// test.kt:14 box // test.kt:19 box // test.kt:30 nop // test.kt:21 box diff --git a/compiler/testData/debug/stepping/kt42208.kt b/compiler/testData/debug/stepping/kt42208.kt index f2eb0688b5e..9d45efd9964 100644 --- a/compiler/testData/debug/stepping/kt42208.kt +++ b/compiler/testData/debug/stepping/kt42208.kt @@ -20,7 +20,6 @@ inline fun foo() = { // test.kt:6 box // EXPECTATIONS JS_IR -// test1.kt:10 box -// test.kt:5 box +// test1.kt:9 box // test1.kt:7 box$lambda // test.kt:6 box diff --git a/compiler/testData/debug/stepping/kt42208b.kt b/compiler/testData/debug/stepping/kt42208b.kt index 5cb6617b40c..d6dbcdb3a29 100644 --- a/compiler/testData/debug/stepping/kt42208b.kt +++ b/compiler/testData/debug/stepping/kt42208b.kt @@ -26,8 +26,7 @@ inline fun foo() = { // test.kt:7 box // EXPECTATIONS JS_IR -// test1.kt:11 box -// test.kt:5 box +// test1.kt:10 box // test.kt:6 box // test1.kt:8 box$lambda // test.kt:7 box diff --git a/compiler/testData/debug/stepping/kt42208c.kt b/compiler/testData/debug/stepping/kt42208c.kt index 95aff6b96f9..8174364f47d 100644 --- a/compiler/testData/debug/stepping/kt42208c.kt +++ b/compiler/testData/debug/stepping/kt42208c.kt @@ -44,8 +44,7 @@ fun baz(v:(() -> Unit)) { // test3.kt:15 baz // test1.kt:9 box$lambda // test3.kt:16 baz -// test1.kt:12 box -// test.kt:6 box +// test1.kt:11 box // test.kt:7 box // test3.kt:15 baz // test1.kt:9 box$lambda diff --git a/compiler/testData/debug/stepping/lambdaStepInline.kt b/compiler/testData/debug/stepping/lambdaStepInline.kt index a5f9d2f8c94..90820b1d0a7 100644 --- a/compiler/testData/debug/stepping/lambdaStepInline.kt +++ b/compiler/testData/debug/stepping/lambdaStepInline.kt @@ -25,8 +25,4 @@ fun box(): String { // test.kt:13 box // EXPECTATIONS JS_IR -// test.kt:8 box -// test.kt:4 box -// test.kt:10 box -// test.kt:4 box // test.kt:13 box diff --git a/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt b/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt index 1413e00473f..1355ef8fd20 100644 --- a/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt +++ b/compiler/testData/debug/stepping/lambdaStepInlineWithDefaults.kt @@ -30,8 +30,4 @@ fun box(): String { // test.kt:16 box // EXPECTATIONS JS_IR -// test.kt:2 box -// test.kt:3 box -// test.kt:7 box -// test.kt:10 box // test.kt:16 box diff --git a/compiler/testData/debug/stepping/nestedInline.kt b/compiler/testData/debug/stepping/nestedInline.kt index 213c603c8ff..2d39723df91 100644 --- a/compiler/testData/debug/stepping/nestedInline.kt +++ b/compiler/testData/debug/stepping/nestedInline.kt @@ -69,8 +69,5 @@ inline fun html(init: () -> Unit) { // 1.kt:33 box // 1.kt:36 box // 1.kt:37 box -// 1.kt:37 box -// 1.kt:41 box // test.kt:15 box -// test.kt:19 box // test.kt:21 box diff --git a/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt b/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt index 02069d11671..05457065543 100644 --- a/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt +++ b/compiler/testData/debug/stepping/noParametersArgumentCallInExpression.kt @@ -23,6 +23,5 @@ inline fun lookAtMe(f: () -> Int) { // EXPECTATIONS JS_IR // test.kt:11 box -// test.kt:6 box // test.kt:12 box // test.kt:8 box diff --git a/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt b/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt index 33688296c5d..63d8b069d8c 100644 --- a/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt +++ b/compiler/testData/debug/stepping/simpleDefaultArgWithInline.kt @@ -26,5 +26,4 @@ fun box(): String { // test.kt:14 box // EXPECTATIONS JS_IR -// test.kt:5 box -// test.kt:14 box \ No newline at end of file +// test.kt:14 box diff --git a/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt b/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt index 4a97d1469ea..ef264b020aa 100644 --- a/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt +++ b/compiler/testData/debug/stepping/simpleInlineDefaultArg.kt @@ -38,6 +38,4 @@ fun box(): String { // test.kt:10 box // EXPECTATIONS JS_IR -// test.kt:3 box -// test.kt:5 box -// test.kt:6 box +// test.kt:10 box diff --git a/compiler/testData/debug/stepping/smapInlineAsArgument.kt b/compiler/testData/debug/stepping/smapInlineAsArgument.kt index ed940aac5bd..7e106fd893b 100644 --- a/compiler/testData/debug/stepping/smapInlineAsArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsArgument.kt @@ -38,14 +38,12 @@ fun fail() : String { // test.kt:9 box // EXPECTATIONS JS_IR -// test.kt:16 box // test.kt:4 box // test.kt:20 fail // test.kt:4 box // test.kt:13 checkEquals // test.kt:7 box // test.kt:20 fail -// test.kt:16 box // test.kt:7 box // test.kt:13 checkEquals // test.kt:9 box diff --git a/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt b/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt index 3016f202b61..6711fbc1721 100644 --- a/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsInfixArgument.kt @@ -36,14 +36,12 @@ fun fail() : String { // test.kt:11 box // EXPECTATIONS JS_IR -// test.kt:14 box // test.kt:6 box // test.kt:18 fail // test.kt:6 box // test.kt:3 execute // test.kt:9 box // test.kt:18 fail -// test.kt:14 box // test.kt:9 box // test.kt:3 execute // test.kt:11 box diff --git a/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt b/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt index 7db294a592b..f132745a3e4 100644 --- a/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineAsInlineArgument.kt @@ -38,14 +38,8 @@ fun fail() : String { // test.kt:9 box // EXPECTATIONS JS_IR -// test.kt:16 box -// test.kt:4 box // test.kt:5 box // test.kt:20 fail -// test.kt:16 box // test.kt:7 box // test.kt:20 fail -// test.kt:16 box -// test.kt:8 box -// test.kt:16 box // test.kt:9 box diff --git a/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt b/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt index 3f39d8c34a7..5c74006ce24 100644 --- a/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt +++ b/compiler/testData/debug/stepping/smapInlineInIntrinsicArgument.kt @@ -38,10 +38,8 @@ fun fail() : String { // EXPECTATIONS JS_IR // test.kt:12 box -// test.kt:4 box // test.kt:16 fail // test.kt:7 box // test.kt:16 fail -// test.kt:12 box // test.kt:7 box // test.kt:9 box diff --git a/compiler/testData/debug/stepping/stringSwitches.kt b/compiler/testData/debug/stepping/stringSwitches.kt index ce6e76e8975..379c189cb8c 100644 --- a/compiler/testData/debug/stepping/stringSwitches.kt +++ b/compiler/testData/debug/stepping/stringSwitches.kt @@ -117,9 +117,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:5 stringSwitch // test.kt:11 stringSwitch -// test.kt:11 stringSwitch // test.kt:12 stringSwitch -// test.kt:19 stringSwitch // test.kt:18 stringSwitch // test.kt:21 stringSwitch // test.kt:26 stringSwitch @@ -127,9 +125,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:6 stringSwitch // test.kt:11 stringSwitch -// test.kt:11 stringSwitch // test.kt:13 stringSwitch -// test.kt:19 stringSwitch // test.kt:18 stringSwitch // test.kt:22 stringSwitch // test.kt:26 stringSwitch @@ -137,9 +133,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:7 stringSwitch // test.kt:11 stringSwitch -// test.kt:11 stringSwitch // test.kt:14 stringSwitch -// test.kt:19 stringSwitch // test.kt:18 stringSwitch // test.kt:23 stringSwitch // test.kt:26 stringSwitch @@ -147,9 +141,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:8 stringSwitch // test.kt:11 stringSwitch -// test.kt:11 stringSwitch // test.kt:15 stringSwitch -// test.kt:19 stringSwitch // test.kt:18 stringSwitch // test.kt:24 stringSwitch // test.kt:26 stringSwitch diff --git a/compiler/testData/debug/stepping/stringSwitchesSmall.kt b/compiler/testData/debug/stepping/stringSwitchesSmall.kt index 40c199db822..c3fd18b2d2c 100644 --- a/compiler/testData/debug/stepping/stringSwitchesSmall.kt +++ b/compiler/testData/debug/stepping/stringSwitchesSmall.kt @@ -100,9 +100,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:5 stringSwitch // test.kt:10 stringSwitch -// test.kt:10 stringSwitch // test.kt:11 stringSwitch -// test.kt:17 stringSwitch // test.kt:16 stringSwitch // test.kt:19 stringSwitch // test.kt:23 stringSwitch @@ -110,9 +108,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:6 stringSwitch // test.kt:10 stringSwitch -// test.kt:10 stringSwitch // test.kt:12 stringSwitch -// test.kt:17 stringSwitch // test.kt:16 stringSwitch // test.kt:20 stringSwitch // test.kt:23 stringSwitch @@ -120,9 +116,7 @@ fun box() { // test.kt:4 stringSwitch // test.kt:7 stringSwitch // test.kt:10 stringSwitch -// test.kt:10 stringSwitch // test.kt:13 stringSwitch -// test.kt:17 stringSwitch // test.kt:16 stringSwitch // test.kt:21 stringSwitch // test.kt:23 stringSwitch diff --git a/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt b/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt index 777f5ec332f..733a84545b4 100644 --- a/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt +++ b/compiler/testData/debug/stepping/suspendFunWithSuspendLambdaParameter.kt @@ -26,7 +26,7 @@ suspend fun box() { // test.kt:9 doResume // test.kt:9 box$slambda // test.kt:9 doResume -// test.kt:5 foo +// test.kt:6 foo // test.kt:5 foo // test.kt:10 doResume // test.kt:12 doResume diff --git a/compiler/testData/debug/stepping/voidLambdaStepInline.kt b/compiler/testData/debug/stepping/voidLambdaStepInline.kt index bb23d0f11ec..f5385494d07 100644 --- a/compiler/testData/debug/stepping/voidLambdaStepInline.kt +++ b/compiler/testData/debug/stepping/voidLambdaStepInline.kt @@ -18,6 +18,4 @@ fun box(): String { // test.kt:8 box // EXPECTATIONS JS_IR -// test.kt:4 box -// test.kt:6 box // test.kt:8 box diff --git a/compiler/testData/debug/stepping/whenComplicatedSubject.kt b/compiler/testData/debug/stepping/whenComplicatedSubject.kt index 975f9008596..b74a37e6c7c 100644 --- a/compiler/testData/debug/stepping/whenComplicatedSubject.kt +++ b/compiler/testData/debug/stepping/whenComplicatedSubject.kt @@ -52,18 +52,13 @@ fun box() { // test.kt:16 box // test.kt:5 foo // test.kt:6 foo -// test.kt:10 foo -// test.kt:11 foo // test.kt:13 foo // test.kt:17 box // test.kt:5 foo // test.kt:7 foo -// test.kt:10 foo -// test.kt:11 foo // test.kt:13 foo // test.kt:18 box // test.kt:5 foo // test.kt:8 foo -// test.kt:10 foo // test.kt:13 foo // test.kt:19 box diff --git a/compiler/testData/debug/stepping/whenConstant.kt b/compiler/testData/debug/stepping/whenConstant.kt index 87cfbe3adfb..ce0a54e5204 100644 --- a/compiler/testData/debug/stepping/whenConstant.kt +++ b/compiler/testData/debug/stepping/whenConstant.kt @@ -24,5 +24,4 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:4 box -// test.kt:4 box // test.kt:12 box diff --git a/compiler/testData/debug/stepping/whenExpr.kt b/compiler/testData/debug/stepping/whenExpr.kt index bd7520f8a08..8c0e19e717a 100644 --- a/compiler/testData/debug/stepping/whenExpr.kt +++ b/compiler/testData/debug/stepping/whenExpr.kt @@ -26,5 +26,4 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:4 box // test.kt:5 box -// test.kt:5 box -// test.kt:16 box \ No newline at end of file +// test.kt:16 box diff --git a/compiler/testData/debug/stepping/whenIsChecks.kt b/compiler/testData/debug/stepping/whenIsChecks.kt index 106453d39db..422c0c02654 100644 --- a/compiler/testData/debug/stepping/whenIsChecks.kt +++ b/compiler/testData/debug/stepping/whenIsChecks.kt @@ -39,15 +39,9 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:15 box -// test.kt:4 foo -// test.kt:5 foo // test.kt:12 foo // test.kt:16 box -// test.kt:4 foo -// test.kt:5 foo // test.kt:12 foo // test.kt:17 box -// test.kt:4 foo -// test.kt:5 foo // test.kt:12 foo // test.kt:18 box diff --git a/compiler/testData/debug/stepping/whenMultiLineSubject.kt b/compiler/testData/debug/stepping/whenMultiLineSubject.kt index eaff6d70ec4..acf29cf2df5 100644 --- a/compiler/testData/debug/stepping/whenMultiLineSubject.kt +++ b/compiler/testData/debug/stepping/whenMultiLineSubject.kt @@ -58,22 +58,16 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:26 box // test.kt:4 foo -// test.kt:4 foo -// test.kt:13 foo // test.kt:13 foo // test.kt:15 foo // test.kt:22 foo // test.kt:27 box // test.kt:4 foo -// test.kt:4 foo -// test.kt:13 foo // test.kt:13 foo // test.kt:17 foo // test.kt:22 foo // test.kt:28 box // test.kt:4 foo -// test.kt:4 foo -// test.kt:13 foo // test.kt:13 foo // test.kt:19 foo // test.kt:22 foo diff --git a/compiler/testData/debug/stepping/whenNullalbeSubject.kt b/compiler/testData/debug/stepping/whenNullalbeSubject.kt index b2912c641c4..4caf0ae7a8e 100644 --- a/compiler/testData/debug/stepping/whenNullalbeSubject.kt +++ b/compiler/testData/debug/stepping/whenNullalbeSubject.kt @@ -26,5 +26,4 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:4 box // test.kt:5 box -// test.kt:5 box // test.kt:16 box diff --git a/compiler/testData/debug/stepping/whenSubject.kt b/compiler/testData/debug/stepping/whenSubject.kt index 846d0890017..4312a496ec0 100644 --- a/compiler/testData/debug/stepping/whenSubject.kt +++ b/compiler/testData/debug/stepping/whenSubject.kt @@ -73,24 +73,17 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:18 box // test.kt:4 foo -// test.kt:4 foo // test.kt:5 foo // test.kt:4 foo -// test.kt:4 foo // test.kt:6 foo // test.kt:4 foo -// test.kt:4 foo -// test.kt:10 foo // test.kt:10 foo // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo // test.kt:10 foo -// test.kt:10 foo // test.kt:12 foo // test.kt:4 foo -// test.kt:4 foo -// test.kt:10 foo // test.kt:10 foo // test.kt:13 foo // test.kt:10 foo @@ -98,24 +91,17 @@ fun box() { // test.kt:10 foo // test.kt:15 foo // test.kt:10 foo -// test.kt:10 foo // test.kt:11 foo // test.kt:4 foo -// test.kt:4 foo // test.kt:6 foo // test.kt:4 foo -// test.kt:4 foo -// test.kt:10 foo // test.kt:10 foo // test.kt:13 foo // test.kt:10 foo // test.kt:15 foo // test.kt:10 foo -// test.kt:10 foo // test.kt:12 foo // test.kt:4 foo -// test.kt:4 foo -// test.kt:10 foo // test.kt:10 foo // test.kt:13 foo // test.kt:10 foo diff --git a/compiler/testData/debug/stepping/whenSubject2.kt b/compiler/testData/debug/stepping/whenSubject2.kt index 885525f03ce..dbcbb73ee05 100644 --- a/compiler/testData/debug/stepping/whenSubject2.kt +++ b/compiler/testData/debug/stepping/whenSubject2.kt @@ -122,50 +122,36 @@ fun box() { // EXPECTATIONS JS_IR // test.kt:22 box -// test.kt:5 foo // test.kt:4 foo // test.kt:7 foo -// test.kt:5 foo // test.kt:4 foo // test.kt:8 foo -// test.kt:5 foo // test.kt:4 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:16 foo -// test.kt:5 foo // test.kt:4 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo // test.kt:12 foo // test.kt:19 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:15 foo -// test.kt:5 foo // test.kt:4 foo // test.kt:8 foo -// test.kt:5 foo // test.kt:4 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:17 foo // test.kt:12 foo // test.kt:19 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:16 foo -// test.kt:5 foo // test.kt:4 foo -// test.kt:13 foo // test.kt:12 foo // test.kt:17 foo // test.kt:12 foo diff --git a/compiler/testData/debug/stepping/whenWithInlineInCondition.kt b/compiler/testData/debug/stepping/whenWithInlineInCondition.kt index 4326dac6cfd..a619cfbfbb1 100644 --- a/compiler/testData/debug/stepping/whenWithInlineInCondition.kt +++ b/compiler/testData/debug/stepping/whenWithInlineInCondition.kt @@ -73,27 +73,15 @@ fun nop() {} // EXPECTATIONS JS_IR // test.kt:3 box // test.kt:19 value -// test.kt:4 box -// test.kt:20 box // test.kt:5 box -// test.kt:21 box // test.kt:6 box -// test.kt:22 box // test.kt:7 box // test.kt:7 box // test.kt:28 nop // test.kt:20 box // test.kt:12 box -// test.kt:21 box -// test.kt:12 box -// test.kt:20 box // test.kt:13 box -// test.kt:26 box -// test.kt:13 box -// test.kt:21 box -// test.kt:14 box -// test.kt:25 box // test.kt:14 box // test.kt:14 box // test.kt:28 nop -// test.kt:17 box \ No newline at end of file +// test.kt:17 box diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java index 89efb13f448..cb747671042 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JSConfigurationKeys.java @@ -121,4 +121,6 @@ public class JSConfigurationKeys { public static final CompilerConfigurationKey ZIP_FILE_SYSTEM_ACCESSOR = CompilerConfigurationKey.create("zip file system accessor, used for klib reading"); + public static final CompilerConfigurationKey OPTIMIZE_GENERATED_JS = + CompilerConfigurationKey.create("perform additional optimizations on the generated JS code"); } diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/DoWhileGuardElimination.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/DoWhileGuardElimination.kt index ad8d7d5e92c..99b28c9807d 100644 --- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/DoWhileGuardElimination.kt +++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/DoWhileGuardElimination.kt @@ -74,7 +74,7 @@ internal class DoWhileGuardElimination(private val root: JsStatement) { else -> null } - if (guard != null) { + if (guard != null && guard.statement !is JsLoop) { // When do..while loop has no label and we encounter `break guard` from nested loop, we can't // replace this break with continue. Example: diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/TemporaryVariableElimination.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/TemporaryVariableElimination.kt index 03feaf086bb..37242ebc24c 100644 --- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/TemporaryVariableElimination.kt +++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/TemporaryVariableElimination.kt @@ -88,6 +88,16 @@ import org.jetbrains.kotlin.js.translate.utils.splitToRanges * foo(B, $a) * * we get `$a` eliminated. + * + * It is also worth taking care of the temporary variables captured into closure as they cannot be simply removed. + * + * function test(a) { + * var tmp_a = a // removing this temporary variable changes function behaviour + * var f = function() { console.log(tmp_a) } + * a = [] + * return f + * } + * */ internal class TemporaryVariableElimination(private val function: JsFunction) { private val root = function.body @@ -95,6 +105,7 @@ internal class TemporaryVariableElimination(private val function: JsFunction) { private val usages = mutableMapOf() private val definedValues = mutableMapOf() private val temporary = mutableSetOf() + private val capturedInClosure = mutableSetOf() private var hasChanges = false private val localVariables = function.collectLocalVariables() @@ -201,6 +212,7 @@ internal class TemporaryVariableElimination(private val function: JsFunction) { for (freeVar in x.collectFreeVariables()) { useVariable(freeVar) useVariable(freeVar) + capturedInClosure += freeVar } } @@ -260,9 +272,12 @@ internal class TemporaryVariableElimination(private val function: JsFunction) { namesWithSideEffects += name } } - } - else if (sideEffects) { - invalidateTemporaries() + } else { + if (sideEffects) { + invalidateTemporaries() + } else { + invalidateTemporariesUsingName(name) + } } } @@ -359,6 +374,21 @@ internal class TemporaryVariableElimination(private val function: JsFunction) { lastAssignedVars.clear() } + private fun invalidateTemporariesUsingName(name: JsName) { + lastAssignedVars.removeAll { (_, expr) -> + var nameUsed = false + object : RecursiveJsVisitor() { + override fun visitNameRef(nameRef: JsNameRef) { + if (nameRef.name == name) { + nameUsed = true + } + super.visitNameRef(nameRef) + } + }.accept(expr) + nameUsed + } + } + private fun handleExpression(expression: JsExpression): Boolean { val candidateFinder = SubstitutionCandidateFinder() candidateFinder.accept(expression) @@ -593,7 +623,9 @@ internal class TemporaryVariableElimination(private val function: JsFunction) { (definitions[name] ?: 0) > 0 && (usages[name] ?: 0) == 0 && name in temporary && !name.imported private fun shouldConsiderTemporary(name: JsName): Boolean { - if (definitions[name] != 1 || name !in temporary) return false + if (definitions[name] != 1 || name !in temporary || name in capturedInClosure) { + return false + } val expr = definedValues[name] // It's useful to copy trivial expressions when they are used more than once. Example are temporary variables diff --git a/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt b/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt index f9b43e5feb8..f9cd45c9c42 100644 --- a/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt +++ b/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt @@ -12,4 +12,4 @@ fun baz() = 1 fun bar() = 2 // LINES(JS): 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 12 12 12 -// LINES(JS_IR): 1 2 8 * 3 4 5 * 8 8 10 10 10 10 12 12 12 12 +// LINES(JS_IR): 1 2 8 * 4 3 4 5 * 8 8 10 10 10 10 12 12 12 12 diff --git a/js/js.translator/testData/lineNumbers/conditionalDecomposed.kt b/js/js.translator/testData/lineNumbers/conditionalDecomposed.kt index 92c2abc4129..31578c63872 100644 --- a/js/js.translator/testData/lineNumbers/conditionalDecomposed.kt +++ b/js/js.translator/testData/lineNumbers/conditionalDecomposed.kt @@ -14,5 +14,5 @@ private inline fun foo(): Int { return 23 } -// LINES(JS): 1 10 3 3 3 4 3 6 13 13 3 14 2 12 15 13 13 14 14 -// LINES(JS_IR): 1 1 * 3 4 6 * 8 * 13 13 14 14 8 2 12 12 13 13 14 14 +// LINES(JS): 1 10 3 3 3 4 3 6 13 13 3 14 2 12 15 13 13 14 14 +// LINES(JS_IR): 1 1 * 3 4 6 * 13 13 14 2 12 12 13 13 14 14 diff --git a/js/js.translator/testData/lineNumbers/coroutine.kt b/js/js.translator/testData/lineNumbers/coroutine.kt index 1bd3b48644a..5d0a8d35879 100644 --- a/js/js.translator/testData/lineNumbers/coroutine.kt +++ b/js/js.translator/testData/lineNumbers/coroutine.kt @@ -15,4 +15,4 @@ suspend fun bar(): Unit { } // LINES(JS): 39 4 4 4 7 5 5 45 45 5 93 45 5 5 6 4 4 4 9 15 9 9 9 * 9 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14 * 9 15 9 9 9 9 -// LINES(JS_IR): 4 4 * 19 * 5 * 45 * 93 93 45 45 45 6 6 19 7 7 9 9 * 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 14 14 15 15 +// LINES(JS_IR): 4 4 * 93 93 45 45 7 7 6 9 9 * 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 14 14 15 15 diff --git a/js/js.translator/testData/lineNumbers/destructuringInline.kt b/js/js.translator/testData/lineNumbers/destructuringInline.kt index 50ef2cef69c..6a6508adae9 100644 --- a/js/js.translator/testData/lineNumbers/destructuringInline.kt +++ b/js/js.translator/testData/lineNumbers/destructuringInline.kt @@ -33,4 +33,4 @@ inline operator fun P.component1() = a inline operator fun P.component2() = b // LINES(JS): 15 22 17 17 31 18 18 33 20 20 21 21 22 22 3 23 9 9 9 9 4 9 9 9 6 6 31 7 7 33 11 11 12 12 15 15 25 27 26 26 29 29 29 * 31 31 31 33 33 33 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 4 9 * 6 * 31 31 6 * 7 * 33 33 7 11 11 12 12 15 15 25 25 26 26 29 29 29 29 29 29 29 29 29 29 29 29 31 31 31 31 33 33 33 33 15 16 15 * 17 * 31 31 17 * 18 * 33 33 18 20 20 21 21 22 22 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 4 9 * 6 31 * 7 33 11 11 12 12 15 15 25 25 26 26 29 29 29 29 29 29 29 29 29 29 29 29 31 31 31 31 33 33 33 33 15 16 15 * 17 31 * 18 33 20 20 21 21 22 22 * 1 diff --git a/js/js.translator/testData/lineNumbers/elvis.kt b/js/js.translator/testData/lineNumbers/elvis.kt index 02b0760620d..2d74b65d780 100644 --- a/js/js.translator/testData/lineNumbers/elvis.kt +++ b/js/js.translator/testData/lineNumbers/elvis.kt @@ -10,4 +10,4 @@ fun box(x: String?) { fun foo() = "bar" // LINES(JS): 3 8 7 7 4 4 4 5 5 7 7 7 7 * 5 4 5 10 10 10 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 5 * 5 5 * 7 7 7 * 5 4 4 10 10 10 10 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 * 5 5 * 7 7 7 * 5 4 4 10 10 10 10 * 1 diff --git a/js/js.translator/testData/lineNumbers/for.kt b/js/js.translator/testData/lineNumbers/for.kt index e03f9504e78..282e153fce5 100644 --- a/js/js.translator/testData/lineNumbers/for.kt +++ b/js/js.translator/testData/lineNumbers/for.kt @@ -17,5 +17,5 @@ fun box() { } } -// LINES(JS): 1 18 2 2 10 2 2 2 2 2 2 3 3 6 6 6 6 7 7 10 10 10 10 10 10 11 11 14 14 15 15 15 15 16 16 -// LINES(JS_IR): 1 1 * 2 * 35 * 18 * 12 2 18 18 35 35 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 10 10 10 10 11 11 14 15 15 15 15 15 15 15 15 16 16 +// LINES(JS): 1 18 2 2 10 2 2 2 2 2 2 3 3 6 6 6 6 7 7 10 10 10 10 10 10 11 11 14 14 15 15 15 15 16 16 +// LINES(JS_IR): 1 1 * 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 10 10 10 10 11 11 14 15 15 15 15 15 15 15 15 16 16 diff --git a/js/js.translator/testData/lineNumbers/increment.kt b/js/js.translator/testData/lineNumbers/increment.kt index 56cc7be61af..da33f21341e 100644 --- a/js/js.translator/testData/lineNumbers/increment.kt +++ b/js/js.translator/testData/lineNumbers/increment.kt @@ -8,5 +8,5 @@ fun foo(x: Int) { println(y) } -// LINES(JS): 1 9 2 2 3 3 4 4 5 5 6 6 7 7 8 8 -// LINES(JS_IR): 1 1 2 3 3 3 4 4 5 5 6 6 7 7 8 8 +// LINES(JS): 1 9 2 2 3 3 4 4 5 5 6 6 7 7 8 8 +// LINES(JS_IR): 1 1 2 3 3 4 4 5 5 6 6 7 7 8 8 diff --git a/js/js.translator/testData/lineNumbers/inlineArguments.kt b/js/js.translator/testData/lineNumbers/inlineArguments.kt index 12f58b39983..056f45fe17c 100644 --- a/js/js.translator/testData/lineNumbers/inlineArguments.kt +++ b/js/js.translator/testData/lineNumbers/inlineArguments.kt @@ -12,4 +12,4 @@ inline fun foo(x: Int) { fun bar() = 23 // LINES(JS): 3 5 4 4 8 8 9 9 7 10 8 8 9 9 12 12 12 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 * 4 8 8 9 9 7 7 8 8 9 9 12 12 12 12 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 * 4 8 8 9 9 7 7 8 8 9 9 12 12 12 12 * 1 diff --git a/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt b/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt index f2ea4357312..2e76b42bb57 100644 --- a/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt +++ b/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt @@ -10,4 +10,4 @@ fun bar() { } // LINES(JS): 1 1 1 1 1 6 2 2 3 3 4 4 8 10 2 2 9 2 3 3 4 4 -// LINES(JS_IR): 1 1 2 3 3 3 4 4 8 8 9 * 2 3 3 3 4 4 +// LINES(JS_IR): 1 1 2 3 3 3 4 4 8 8 * 2 3 3 3 4 4 diff --git a/js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt b/js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt index 280305960ec..972872347e2 100644 --- a/js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt +++ b/js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt @@ -22,5 +22,5 @@ fun box() { foo("42") } -// LINES(JS): 6 20 23 7 7 21 7 8 8 21 8 7 7 22 7 8 8 22 8 -// LINES(JS_IR): 20 20 21 * 7 7 8 8 22 * 7 7 8 8 +// LINES(JS): 6 20 23 7 7 21 7 8 8 21 8 7 7 22 7 8 8 22 8 +// LINES(JS_IR): 20 20 * 7 7 8 8 * 7 7 8 8 diff --git a/js/js.translator/testData/lineNumbers/inlining.kt b/js/js.translator/testData/lineNumbers/inlining.kt index f01c9bc8bc7..df3a1542c14 100644 --- a/js/js.translator/testData/lineNumbers/inlining.kt +++ b/js/js.translator/testData/lineNumbers/inlining.kt @@ -11,5 +11,5 @@ inline fun bar() { println("bar2") } -// LINES(JS): 1 7 2 2 10 10 11 11 4 4 10 10 11 11 6 6 9 9 9 9 9 12 10 10 11 11 -// LINES(JS_IR): 1 1 2 2 3 * 10 10 11 11 4 4 5 * 10 10 11 11 6 6 9 9 10 10 11 11 +// LINES(JS): 1 7 2 2 10 10 11 11 4 4 10 10 11 11 6 6 9 9 9 9 9 12 10 10 11 11 +// LINES(JS_IR): 1 1 2 2 * 10 10 11 11 4 4 * 10 10 11 11 6 6 9 9 10 10 11 11 diff --git a/js/js.translator/testData/lineNumbers/inliningWithLambda.kt b/js/js.translator/testData/lineNumbers/inliningWithLambda.kt index b6f2cdd1a12..ff7f4767076 100644 --- a/js/js.translator/testData/lineNumbers/inliningWithLambda.kt +++ b/js/js.translator/testData/lineNumbers/inliningWithLambda.kt @@ -16,5 +16,5 @@ inline fun foo(f: () -> Unit) { println("after") } -// LINES(JS): 1 11 2 2 14 14 4 4 16 16 6 6 14 14 8 8 16 16 10 10 13 13 13 13 13 17 14 14 15 15 16 16 -// LINES(JS_IR): 1 1 2 2 3 * 14 14 15 * 4 4 16 16 6 6 7 * 14 14 15 * 8 8 16 16 10 10 13 13 14 14 15 15 16 16 +// LINES(JS): 1 11 2 2 14 14 4 4 16 16 6 6 14 14 8 8 16 16 10 10 13 13 13 13 13 17 14 14 15 15 16 16 +// LINES(JS_IR): 1 1 2 2 * 14 14 * 4 4 16 16 6 6 * 14 14 * 8 8 16 16 10 10 13 13 14 14 15 15 16 16 diff --git a/js/js.translator/testData/lineNumbers/isOperator.kt b/js/js.translator/testData/lineNumbers/isOperator.kt index 8afb25627c8..e002aef7c28 100644 --- a/js/js.translator/testData/lineNumbers/isOperator.kt +++ b/js/js.translator/testData/lineNumbers/isOperator.kt @@ -11,5 +11,5 @@ inline fun foo(): Boolean { return true } -// LINES(JS): 3 7 4 4 4 10 10 4 11 4 5 5 9 12 10 10 11 11 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 * 4 4 * 4 * 10 10 11 11 4 4 4 5 5 9 9 10 10 11 11 * 1 +// LINES(JS): 3 7 4 4 4 10 10 4 11 4 5 5 9 12 10 10 11 11 * 1 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 * 4 4 * 10 10 11 4 4 4 5 5 9 9 10 10 11 11 * 1 diff --git a/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt b/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt index 92d93e497c5..815a0c2679e 100644 --- a/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt +++ b/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt @@ -24,5 +24,5 @@ fun baz() = "baz" fun boo() = "boo" -// LINES(JS): 1 17 9 4 6 6 7 7 3 3 3 * 13 12 13 13 14 19 21 20 20 23 23 23 25 25 25 -// LINES(JS_IR): 1 1 * 2 * 20 * 4 * 6 7 * 3 20 20 * 11 * 20 * 12 12 13 14 20 20 19 19 20 20 23 23 23 23 25 25 25 25 +// LINES(JS): 1 17 9 4 6 6 7 7 3 3 3 * 13 12 13 13 14 19 21 20 20 23 23 23 25 25 25 +// LINES(JS_IR): 1 1 * 4 * 6 7 * 13 12 13 19 19 20 20 23 23 23 23 25 25 25 25 diff --git a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt index 35ecb04dda6..c5455df4132 100644 --- a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt +++ b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt @@ -19,4 +19,4 @@ fun box(x: Int) { } // LINES(JS): 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2 -// LINES(JS_IR): 1 1 4 2 8 7 6 7 8 9 12 11 12 13 16 +// LINES(JS_IR): 1 1 2 8 7 6 4 6 7 4 7 8 4 8 9 12 11 4 11 12 4 12 13 16 diff --git a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt index e5bc4e4773a..a641b9370da 100644 --- a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt +++ b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt @@ -29,4 +29,4 @@ fun four() = 4 fun five() = 5 // LINES(JS): 1 19 4 4 3 6 4 6 4 7 4 8 9 9 11 4 11 4 12 13 13 16 16 2 21 21 21 23 23 23 25 25 25 27 27 27 29 29 29 -// LINES(JS_IR): 1 1 4 2 8 7 6 7 8 9 12 11 12 13 16 21 21 21 21 23 23 23 23 25 25 25 25 27 27 27 27 29 29 29 29 +// LINES(JS_IR): 1 1 2 8 7 6 4 6 7 4 7 8 4 8 9 12 11 4 11 12 4 12 13 16 21 21 21 21 23 23 23 23 25 25 25 25 27 27 27 27 29 29 29 29