[JS IR] Generate 'names' entries for functions in sourcemaps
This commit is contained in:
committed by
Space Team
parent
1d0025c3cf
commit
d9681caf0c
+27
-7
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
|||||||
import org.jetbrains.kotlin.ir.backend.js.JsStatementOrigins
|
import org.jetbrains.kotlin.ir.backend.js.JsStatementOrigins
|
||||||
import org.jetbrains.kotlin.ir.backend.js.sourceMapsInfo
|
import org.jetbrains.kotlin.ir.backend.js.sourceMapsInfo
|
||||||
import org.jetbrains.kotlin.ir.backend.js.utils.*
|
import org.jetbrains.kotlin.ir.backend.js.utils.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
@@ -24,6 +21,7 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
|||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
import org.jetbrains.kotlin.js.backend.ast.*
|
import org.jetbrains.kotlin.js.backend.ast.*
|
||||||
import org.jetbrains.kotlin.js.common.isValidES5Identifier
|
import org.jetbrains.kotlin.js.common.isValidES5Identifier
|
||||||
|
import org.jetbrains.kotlin.js.config.SourceMapNamesPolicy
|
||||||
import org.jetbrains.kotlin.js.config.SourceMapSourceEmbedding
|
import org.jetbrains.kotlin.js.config.SourceMapSourceEmbedding
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
@@ -119,6 +117,7 @@ fun translateFunction(declaration: IrFunction, name: JsName?, context: JsGenerat
|
|||||||
val body = declaration.body?.accept(IrElementToJsStatementTransformer(), functionContext) as? JsBlock ?: JsBlock()
|
val body = declaration.body?.accept(IrElementToJsStatementTransformer(), functionContext) as? JsBlock ?: JsBlock()
|
||||||
|
|
||||||
val function = JsFunction(emptyScope, body, "member function ${name ?: "annon"}")
|
val function = JsFunction(emptyScope, body, "member function ${name ?: "annon"}")
|
||||||
|
.withSource(declaration, context, useNameOf = declaration)
|
||||||
|
|
||||||
function.name = name
|
function.name = name
|
||||||
|
|
||||||
@@ -522,16 +521,18 @@ object JsAstUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T : JsNode> T.withSource(node: IrElement, context: JsGenerationContext, originalName: String? = null): T {
|
internal fun <T : JsNode> T.withSource(node: IrElement, context: JsGenerationContext, useNameOf: IrDeclarationWithName? = null): T {
|
||||||
addSourceInfoIfNeed(node, context, originalName)
|
addSourceInfoIfNeed(node, context, useNameOf)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
private inline fun <T : JsNode> T.addSourceInfoIfNeed(node: IrElement, context: JsGenerationContext, originalName: String?) {
|
private inline fun <T : JsNode> T.addSourceInfoIfNeed(node: IrElement, context: JsGenerationContext, useNameOf: IrDeclarationWithName?) {
|
||||||
|
|
||||||
val sourceMapsInfo = context.staticContext.backendContext.sourceMapsInfo ?: return
|
val sourceMapsInfo = context.staticContext.backendContext.sourceMapsInfo ?: return
|
||||||
|
|
||||||
|
val originalName = useNameOf?.originalNameForUseInSourceMap(sourceMapsInfo.namesPolicy)
|
||||||
|
|
||||||
val location = context.getLocationForIrElement(node, originalName) ?: return
|
val location = context.getLocationForIrElement(node, originalName) ?: return
|
||||||
|
|
||||||
val isNodeFromCurrentModule = context.currentFile.module.descriptor == context.staticContext.backendContext.module
|
val isNodeFromCurrentModule = context.currentFile.module.descriptor == context.staticContext.backendContext.module
|
||||||
@@ -579,3 +580,22 @@ fun IrElement.getSourceInfo(fileEntry: IrFileEntry): JsLocation? {
|
|||||||
val startColumn = fileEntry.getColumnNumber(startOffset)
|
val startColumn = fileEntry.getColumnNumber(startOffset)
|
||||||
return JsLocation(path, startLine, startColumn)
|
return JsLocation(path, startLine, startColumn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a name of the original Kotlin declaration, or null, if it is a compiler generated declaration.
|
||||||
|
*/
|
||||||
|
private fun IrDeclarationWithName.originalNameForUseInSourceMap(policy: SourceMapNamesPolicy): String? {
|
||||||
|
if (policy == SourceMapNamesPolicy.NO) return null
|
||||||
|
when (this) {
|
||||||
|
is IrField -> correspondingPropertySymbol?.let {
|
||||||
|
return it.owner.originalNameForUseInSourceMap(policy)
|
||||||
|
}
|
||||||
|
|
||||||
|
is IrFunction -> if (policy == SourceMapNamesPolicy.FULLY_QUALIFIED_NAMES) {
|
||||||
|
fqNameWhenAvailable?.let {
|
||||||
|
return it.asString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name.asString()
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -18,5 +18,5 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:6 box
|
// test.kt:6 box
|
||||||
// test.kt:3 eval_0
|
// test.kt:3 eval
|
||||||
// test.kt:7 box$lambda
|
// test.kt:7 box$lambda
|
||||||
+1
-1
@@ -30,5 +30,5 @@ fun box() {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:9 box
|
// test.kt:9 box
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:4 protoOf.foo_26di_k$
|
// test.kt:4 foo
|
||||||
// test.kt:5 box
|
// test.kt:5 box
|
||||||
+2
-1
@@ -23,6 +23,7 @@ fun f(block: () -> Unit) {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:3 box
|
// test.kt:3 box
|
||||||
// test.kt:4 box
|
// test.kt:4 box
|
||||||
|
// test.kt:4 box$lambda
|
||||||
// test.kt:4 box
|
// test.kt:4 box
|
||||||
// test.kt:10 f
|
// test.kt:10 f
|
||||||
// test.kt:5
|
// test.kt:5 box$lambda$lambda
|
||||||
+2
-2
@@ -32,9 +32,9 @@ fun box() {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:9 box
|
// test.kt:9 box
|
||||||
// test.kt:10 box
|
// test.kt:10 box
|
||||||
// test.kt:4 protoOf.foo_26di_k$
|
// test.kt:4 foo
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:4 protoOf.foo_26di_k$
|
// test.kt:4 foo
|
||||||
// test.kt:5 box
|
// test.kt:5 box
|
||||||
// test.kt:13 box
|
// test.kt:13 box
|
||||||
// test.kt:5 box
|
// test.kt:5 box
|
||||||
+1
-1
@@ -36,5 +36,5 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:12 box
|
// test.kt:12 box
|
||||||
// test.kt:4 A
|
// test.kt:4 <init>
|
||||||
// test.kt:14 box
|
// test.kt:14 box
|
||||||
+3
-3
@@ -40,9 +40,9 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:14 box
|
// test.kt:14 box
|
||||||
// test.kt:5 Companion_19
|
// test.kt:5 <init>
|
||||||
// test.kt:6 Companion_19
|
// test.kt:6 <init>
|
||||||
// test.kt:15 box
|
// test.kt:15 box
|
||||||
// test.kt:16 box
|
// test.kt:16 box
|
||||||
// test.kt:16 box
|
// test.kt:16 box
|
||||||
// test.kt:8 protoOf.foo_26di_k$
|
// test.kt:8 foo
|
||||||
+4
-4
@@ -34,10 +34,10 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:6 box
|
// test.kt:6 box
|
||||||
// test.kt:3 A
|
// test.kt:3 <init>
|
||||||
// test.kt:7 box
|
// test.kt:7 box
|
||||||
// test.kt:3 A
|
// test.kt:3 <init>
|
||||||
// test.kt:10 box
|
// test.kt:10 box
|
||||||
// test.kt:3 A
|
// test.kt:3 <init>
|
||||||
// test.kt:12 box
|
// test.kt:12 box
|
||||||
// test.kt:3 A
|
// test.kt:3 <init>
|
||||||
+4
-4
@@ -188,7 +188,7 @@ class O<T>(i: T) {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:4 box
|
// test.kt:4 box
|
||||||
// test.kt:5 box
|
// test.kt:5 box
|
||||||
// test.kt:20 C
|
// test.kt:20 <init>
|
||||||
// test.kt:6 box
|
// test.kt:6 box
|
||||||
// test.kt:22 D_init_$Init$
|
// test.kt:22 D_init_$Init$
|
||||||
// test.kt:7 box
|
// test.kt:7 box
|
||||||
@@ -200,10 +200,10 @@ class O<T>(i: T) {
|
|||||||
// test.kt:33 G_init_$Init$
|
// test.kt:33 G_init_$Init$
|
||||||
// test.kt:34 G_init_$Init$
|
// test.kt:34 G_init_$Init$
|
||||||
// test.kt:10 box
|
// test.kt:10 box
|
||||||
// test.kt:39 J
|
// test.kt:39 <init>
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:42 K
|
// test.kt:42 <init>
|
||||||
// test.kt:44 K
|
// test.kt:44 <init>
|
||||||
// test.kt:12 box
|
// test.kt:12 box
|
||||||
// test.kt:48 L_init_$Init$
|
// test.kt:48 L_init_$Init$
|
||||||
// test.kt:53 L
|
// test.kt:53 L
|
||||||
|
|||||||
+33
-33
@@ -62,53 +62,53 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:13 box
|
// test.kt:13 box
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:14 box
|
// test.kt:14 box
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:14 box
|
// test.kt:14 box
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:1 protoOf.equals
|
// test.kt:1 equals
|
||||||
// test.kt:15 box
|
// test.kt:15 box
|
||||||
// test.kt:1 protoOf.hashCode
|
// test.kt:1 hashCode
|
||||||
// test.kt:1 protoOf.hashCode
|
// test.kt:1 hashCode
|
||||||
// test.kt:16 box
|
// test.kt:16 box
|
||||||
// test.kt:1 protoOf.toString
|
// test.kt:1 toString
|
||||||
// test.kt:17 box
|
// test.kt:17 box
|
||||||
// test.kt:17 box
|
// test.kt:17 box
|
||||||
// test.kt:1 protoOf.component1_7eebsc_k$
|
// test.kt:1 component1
|
||||||
// test.kt:17 box
|
// test.kt:17 box
|
||||||
// test.kt:1 protoOf.component2_7eebsb_k$
|
// test.kt:1 component2
|
||||||
// test.kt:18 box
|
// test.kt:18 box
|
||||||
// test.kt:1 protoOf.copy$default_roih85_k$
|
// test.kt:1 copy$default
|
||||||
// test.kt:1 protoOf.copy$default_roih85_k$
|
// test.kt:1 copy$default
|
||||||
// test.kt:1 protoOf.copy$default_roih85_k$
|
// test.kt:1 copy$default
|
||||||
// test.kt:1 protoOf.copy_t8q04r_k$
|
// test.kt:1 copy
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:3 D
|
// test.kt:3 <init>
|
||||||
// test.kt:19 box
|
// test.kt:19 box
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
// test.kt:20 box
|
// test.kt:20 box
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
// test.kt:20 box
|
// test.kt:20 box
|
||||||
// test.kt:7 protoOf.equals
|
// test.kt:7 equals
|
||||||
// test.kt:21 box
|
// test.kt:21 box
|
||||||
// test.kt:8 protoOf.hashCode
|
// test.kt:8 hashCode
|
||||||
// test.kt:22 box
|
// test.kt:22 box
|
||||||
// test.kt:6 protoOf.toString
|
// test.kt:6 toString
|
||||||
// test.kt:23 box
|
// test.kt:23 box
|
||||||
// test.kt:23 box
|
// test.kt:23 box
|
||||||
// test.kt:1 protoOf.component1_7eebsc_k$
|
// test.kt:1 component1
|
||||||
// test.kt:23 box
|
// test.kt:23 box
|
||||||
// test.kt:1 protoOf.component2_7eebsb_k$
|
// test.kt:1 component2
|
||||||
// test.kt:24 box
|
// test.kt:24 box
|
||||||
// test.kt:9 protoOf.copy_1tks5_k$
|
// test.kt:9 copy
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
// test.kt:5 E
|
// test.kt:5 <init>
|
||||||
+5
-5
@@ -26,8 +26,8 @@ fun box() {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:6 protoOf.foo$default_ourpn2_k$
|
// test.kt:6 foo$default
|
||||||
// test.kt:4 protoOf.computeParam_vubdyi_k$
|
// test.kt:4 computeParam
|
||||||
// test.kt:6 protoOf.foo$default_ourpn2_k$
|
// test.kt:6 foo$default
|
||||||
// test.kt:6 protoOf.foo$default_ourpn2_k$
|
// test.kt:6 foo$default
|
||||||
// test.kt:6 protoOf.foo$default_ourpn2_k$
|
// test.kt:6 foo$default
|
||||||
+6
-5
@@ -54,11 +54,12 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:22 box
|
// test.kt:22 box
|
||||||
// test.kt:11 E
|
// test.kt:11 <init>
|
||||||
// test.kt:11 E
|
// test.kt:11 <init>
|
||||||
// test.kt:22 box
|
// test.kt:22 box
|
||||||
// test.kt:9 protoOf.foo_26di_k$
|
// test.kt:9 foo
|
||||||
|
// test.kt:7 E$foo$lambda
|
||||||
// test.kt:15 E2_initEntries
|
// test.kt:15 E2_initEntries
|
||||||
// test.kt:14 E2
|
// test.kt:14 <init>
|
||||||
// test.kt:17 E2_initEntries
|
// test.kt:17 E2_initEntries
|
||||||
// test.kt:14 E2
|
// test.kt:14 <init>
|
||||||
@@ -35,4 +35,4 @@ fun foo(f: () -> Unit) {
|
|||||||
// test.kt:5 box$lambda
|
// test.kt:5 box$lambda
|
||||||
// test.kt:8 box
|
// test.kt:8 box
|
||||||
// test.kt:14 foo
|
// test.kt:14 foo
|
||||||
// test.kt:9 box$lambda_0
|
// test.kt:9 box$lambda
|
||||||
+10
-10
@@ -109,18 +109,18 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:48 box
|
// test.kt:48 box
|
||||||
// test.kt:7 Foo
|
// test.kt:7 <init>
|
||||||
// test.kt:45 x
|
// test.kt:45 x
|
||||||
// test.kt:49 box
|
// test.kt:49 box
|
||||||
// test.kt:13 Bar
|
// test.kt:13 <init>
|
||||||
// test.kt:17 Bar
|
// test.kt:17 <init>
|
||||||
// test.kt:50 box
|
// test.kt:50 box
|
||||||
// test.kt:23 Boo
|
// test.kt:23 <init>
|
||||||
// test.kt:26 Boo
|
// test.kt:26 <init>
|
||||||
// test.kt:45 x
|
// test.kt:45 x
|
||||||
// test.kt:29 Boo
|
// test.kt:29 <init>
|
||||||
// test.kt:51 box
|
// test.kt:51 box
|
||||||
// test.kt:34 Zoo
|
// test.kt:34 <init>
|
||||||
// test.kt:36 Zoo
|
// test.kt:36 <init>
|
||||||
// test.kt:39 Zoo
|
// test.kt:39 <init>
|
||||||
// test.kt:42 Zoo
|
// test.kt:42 <init>
|
||||||
+5
-5
@@ -54,10 +54,10 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:29 box
|
// test.kt:29 box
|
||||||
// test.kt:8 Companion_19
|
// test.kt:8 <init>
|
||||||
// test.kt:11 Companion_19
|
// test.kt:11 <init>
|
||||||
// test.kt:26 x
|
// test.kt:26 x
|
||||||
// test.kt:13 Companion_19
|
// test.kt:13 <init>
|
||||||
// test.kt:16 Companion_19
|
// test.kt:16 <init>
|
||||||
// test.kt:21 Companion_19
|
// test.kt:21 <init>
|
||||||
// test.kt:30 box
|
// test.kt:30 box
|
||||||
+1
-1
@@ -27,5 +27,5 @@ fun box() {
|
|||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:15 box
|
// test.kt:15 box
|
||||||
// test.kt:5 A
|
// test.kt:5 <init>
|
||||||
// test.kt:15 box
|
// test.kt:15 box
|
||||||
+1
-1
@@ -45,4 +45,4 @@ fun baz(v:(() -> Unit)) {
|
|||||||
// test.kt:5 box
|
// test.kt:5 box
|
||||||
// test.kt:6 box
|
// test.kt:6 box
|
||||||
// test3.kt:14 baz
|
// test3.kt:14 baz
|
||||||
// test1.kt:8 box$lambda_0
|
// test1.kt:8 box$lambda
|
||||||
@@ -32,7 +32,8 @@ fun g() {}
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:3 box
|
// test.kt:3 box
|
||||||
// test.kt:4 box
|
// test.kt:4 box
|
||||||
|
// test.kt:4 g$ref
|
||||||
// test.kt:4 box
|
// test.kt:4 box
|
||||||
// test.kt:8 f
|
// test.kt:8 f
|
||||||
// test.kt:4 l
|
// test.kt:4 g$ref$lambda
|
||||||
// test.kt:4 l
|
// test.kt:4 g$ref$lambda
|
||||||
+1
-1
@@ -22,4 +22,4 @@ fun box() {
|
|||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
// test.kt:6 protoOf.get_prop_wosl9o_k$
|
// test.kt:6 <get-prop>
|
||||||
@@ -19,7 +19,7 @@ suspend fun box() {
|
|||||||
// test.kt:11 box
|
// test.kt:11 box
|
||||||
|
|
||||||
// EXPECTATIONS JS_IR
|
// EXPECTATIONS JS_IR
|
||||||
// test.kt:8 protoOf.doResume_5yljmg_k$
|
// test.kt:8 doResume
|
||||||
// test.kt:4 foo
|
// test.kt:4 foo
|
||||||
// test.kt:4 foo
|
// test.kt:4 foo
|
||||||
// test.kt:9 box$lambda
|
// test.kt:9 box$lambda
|
||||||
@@ -655,7 +655,6 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitFunction(@NotNull JsFunction x) {
|
public void visitFunction(@NotNull JsFunction x) {
|
||||||
pushSourceInfo(x.getSource());
|
|
||||||
printCommentsBeforeNode(x);
|
printCommentsBeforeNode(x);
|
||||||
|
|
||||||
p.print(CHARS_FUNCTION);
|
p.print(CHARS_FUNCTION);
|
||||||
@@ -664,7 +663,6 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
|||||||
printFunction(x);
|
printFunction(x);
|
||||||
|
|
||||||
printCommentsAfterNode(x);
|
printCommentsAfterNode(x);
|
||||||
popSourceInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// name(<params>) { <body> }
|
// name(<params>) { <body> }
|
||||||
@@ -673,10 +671,10 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
|||||||
nameOf(x);
|
nameOf(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pushSourceInfo(x.getSource());
|
||||||
leftParen();
|
leftParen();
|
||||||
boolean notFirst = false;
|
boolean notFirst = false;
|
||||||
for (Object element : x.getParameters()) {
|
for (JsParameter param : x.getParameters()) {
|
||||||
JsParameter param = (JsParameter) element;
|
|
||||||
notFirst = sepCommaOptSpace(notFirst);
|
notFirst = sepCommaOptSpace(notFirst);
|
||||||
accept(param);
|
accept(param);
|
||||||
}
|
}
|
||||||
@@ -689,6 +687,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
|||||||
printJsBlock(x.getBody(), true, x.getBody().getSource());
|
printJsBlock(x.getBody(), true, x.getBody().getSource());
|
||||||
sourceLocationConsumer.popSourceInfo();
|
sourceLocationConsumer.popSourceInfo();
|
||||||
|
|
||||||
|
popSourceInfo();
|
||||||
|
|
||||||
needSemi = true;
|
needSemi = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1132,6 +1132,15 @@ public class JsAstMapper {
|
|||||||
if (astNode == null) return null;
|
if (astNode == null) return null;
|
||||||
|
|
||||||
CodePosition location = node.getPosition();
|
CodePosition location = node.getPosition();
|
||||||
|
// For functions, consider their location to be at the opening parenthesis.
|
||||||
|
if (node.getType() == TokenStream.FUNCTION) {
|
||||||
|
Node c = node.getFirstChild();
|
||||||
|
while (c != null && c.getType() != TokenStream.LP)
|
||||||
|
c = c.getNext();
|
||||||
|
if (c != null && c.getPosition() != null)
|
||||||
|
location = c.getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
JsLocation jsLocation = new JsLocation(fileName, location.getLine(), location.getOffset());
|
JsLocation jsLocation = new JsLocation(fileName, location.getLine(), location.getOffset());
|
||||||
if (astNode instanceof SourceInfoAwareJsNode) {
|
if (astNode instanceof SourceInfoAwareJsNode) {
|
||||||
|
|||||||
@@ -122,10 +122,14 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t
|
|||||||
topMostCallFrame: Debugger.CallFrame,
|
topMostCallFrame: Debugger.CallFrame,
|
||||||
loggedItems: MutableList<SteppingTestLoggedData>
|
loggedItems: MutableList<SteppingTestLoggedData>
|
||||||
) {
|
) {
|
||||||
sourceMap.getSourceLineForGeneratedLocation(topMostCallFrame.location)?.let { (sourceFile, sourceLine) ->
|
val originalFunctionName = topMostCallFrame.functionLocation?.let {
|
||||||
|
sourceMap.getSourceLineForGeneratedLocation(it)?.name
|
||||||
|
}
|
||||||
|
sourceMap.getSourceLineForGeneratedLocation(topMostCallFrame.location)?.let { (_, sourceFile, sourceLine, _, _) ->
|
||||||
|
if (sourceFile == null || sourceLine < 0) return@let
|
||||||
val testFileName = testFileNameFromMappedLocation(sourceFile, sourceLine) ?: return
|
val testFileName = testFileNameFromMappedLocation(sourceFile, sourceLine) ?: return
|
||||||
val expectation =
|
val expectation =
|
||||||
formatAsSteppingTestExpectation(testFileName, sourceLine + 1, topMostCallFrame.functionName, false)
|
formatAsSteppingTestExpectation(testFileName, sourceLine + 1, originalFunctionName ?: topMostCallFrame.functionName, false)
|
||||||
loggedItems.add(SteppingTestLoggedData(sourceLine + 1, false, expectation))
|
loggedItems.add(SteppingTestLoggedData(sourceLine + 1, false, expectation))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,13 +180,11 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t
|
|||||||
* Maps [location] in the generated JavaScript file to the corresponding location in a source file.
|
* Maps [location] in the generated JavaScript file to the corresponding location in a source file.
|
||||||
* @return The source file path (as specified in the source map) and the line number in that source file.
|
* @return The source file path (as specified in the source map) and the line number in that source file.
|
||||||
*/
|
*/
|
||||||
private fun SourceMap.getSourceLineForGeneratedLocation(location: Debugger.Location): Pair<String, Int>? {
|
private fun SourceMap.getSourceLineForGeneratedLocation(location: Debugger.Location): SourceMapSegment? {
|
||||||
|
|
||||||
fun SourceMapSegment.sourceFileAndLine() = sourceFileName!! to sourceLineNumber
|
|
||||||
|
|
||||||
val group = groups.getOrNull(location.lineNumber)?.takeIf { it.segments.isNotEmpty() } ?: return null
|
val group = groups.getOrNull(location.lineNumber)?.takeIf { it.segments.isNotEmpty() } ?: return null
|
||||||
val columnNumber = location.columnNumber ?: return group.segments[0].sourceFileAndLine()
|
val columnNumber = location.columnNumber ?: return group.segments[0]
|
||||||
val segment = if (columnNumber <= group.segments[0].generatedColumnNumber) {
|
return if (columnNumber <= group.segments[0].generatedColumnNumber) {
|
||||||
group.segments[0]
|
group.segments[0]
|
||||||
} else {
|
} else {
|
||||||
val candidateIndex = group.segments.indexOfFirst {
|
val candidateIndex = group.segments.indexOfFirst {
|
||||||
@@ -195,7 +197,6 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t
|
|||||||
else
|
else
|
||||||
group.segments[candidateIndex - 1]
|
group.segments[candidateIndex - 1]
|
||||||
}
|
}
|
||||||
return segment?.sourceFileAndLine()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ fun box(x: Int, y: Int) {
|
|||||||
|
|
||||||
fun foo(x: Int) = x
|
fun foo(x: Int) = x
|
||||||
|
|
||||||
// LINES(JS): 1 5 3 3 4 3 3 3 3 * 3 3 4 4 4 4 * 4 4 4 4 2 3 7 7 7
|
// LINES(JS): 1 5 3 3 4 3 3 3 3 * 3 3 4 4 4 4 * 4 4 4 4 2 3 7 7 7
|
||||||
// LINES(JS_IR): 3 3 3 * 3 * 4 4 4 * 4 4 2 * 7 7
|
// LINES(JS_IR): 1 * 3 3 3 * 3 * 4 4 4 * 4 4 2 7 7 7
|
||||||
|
|||||||
+2
-2
@@ -12,5 +12,5 @@ open class A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 2 4 4 2 2 2 2 5 5 5 6 7 12 8 9 10 11
|
// LINES(JS): 1 2 2 4 4 2 2 2 2 5 5 5 6 7 12 8 9 10 11
|
||||||
// LINES(JS_IR): 2 2 4 4 * 2 2 * 2 2 * 8 9 10 10 11 * 6 6 5 6
|
// LINES(JS_IR): 1 2 2 4 4 2 2 2 2 2 2 7 8 9 10 10 11 5 6 6 5 6
|
||||||
|
|||||||
+2
-2
@@ -19,5 +19,5 @@ fun bar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 11 3 3 5 5 6 6 8 8 9 9 2 2 * 13 20 15 15 18 18
|
// LINES(JS): 1 11 3 3 5 5 6 6 8 8 9 9 2 2 * 13 20 15 15 18 18
|
||||||
// LINES(JS_IR): 3 3 * 6 6 * 9 9 * 15 15 18 18
|
// LINES(JS_IR): 1 3 3 * 6 6 * 9 9 * 13 15 15 18 18
|
||||||
|
|||||||
+2
-2
@@ -14,5 +14,5 @@ class C {
|
|||||||
val baz: dynamic get() = null
|
val baz: dynamic get() = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 9 2 4 3 2 6 8 7 6 11 12 12 12 14 14 14
|
// LINES(JS): 1 9 2 4 3 2 6 8 7 6 11 12 12 12 14 14 14
|
||||||
// LINES(JS_IR): 2 4 3 2 6 8 7 6 * 12 12 * 14 14
|
// LINES(JS_IR): 1 2 4 3 2 6 8 7 6 11 12 12 12 14 14 14
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ fun A.foo() {
|
|||||||
fun baz() = 23
|
fun baz() = 23
|
||||||
|
|
||||||
// LINES(JS): 1 * 5 5 5 6 9 7 7 8 8 * 3 13 4 4 11 11 12 12 15 15 15
|
// LINES(JS): 1 * 5 5 5 6 9 7 7 8 8 * 3 13 4 4 11 11 12 12 15 15 15
|
||||||
// LINES(JS_IR): 4 4 11 11 12 12 * 15 15 * 7 7 8 8
|
// LINES(JS_IR): 1 3 4 4 11 11 12 12 15 15 15 5 * 6 7 7 8 8
|
||||||
|
|||||||
+2
-2
@@ -5,5 +5,5 @@ fun box(x: Int, y: Int): Int {
|
|||||||
return foo(y)
|
return foo(y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5
|
// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5
|
||||||
// LINES(JS_IR): 5 5 * 4 4
|
// LINES(JS_IR): 1 5 5 2 4 4
|
||||||
|
|||||||
+2
-2
@@ -11,5 +11,5 @@ fun baz() = 1
|
|||||||
|
|
||||||
fun bar() = 2
|
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): 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 3 3 4 5 1 * 8 8 * 10 10 * 12 12
|
// LINES(JS_IR): 1 * 1 3 3 4 5 1 * 8 8 10 10 10 12 12 12
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ private inline fun foo(): Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 10 3 3 3 4 3 6 13 13 3 14 2 12 15 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): 4 6 * 13 13 14 14 8 2 * 13 13 14 14
|
// LINES(JS_IR): 1 * 4 6 * 13 13 14 14 8 2 12 13 13 14 14
|
||||||
|
|||||||
+1
-1
@@ -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): 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): 19 19 * 50 50 93 93 3 45 3 45 45 6 6 19 * 9 9 9 9 9 9 9 9 * 9 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14
|
// LINES(JS_IR): 4 * 19 19 * 50 50 93 93 3 45 3 45 45 6 6 19 9 9 9 9 9 9 9 9 9 9 9 9 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ suspend fun delay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 6 1 1 * 1 6 2 2 2 2 2 * 3 3 4 4 4 4 4 5 5 * 1 6 1 1 1 1 8 9
|
// LINES(JS): 1 6 1 1 * 1 6 2 2 2 2 2 * 3 3 4 4 4 4 4 5 5 * 1 6 1 1 1 1 8 9
|
||||||
// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 1 1 * 2 * 3 3 3 * 5 5
|
// LINES(JS_IR): 1 1 1 1 1 1 1 1 1 8 * 1 1 1 1 * 2 * 3 3 3 * 5 5
|
||||||
|
|||||||
+1
-1
@@ -6,4 +6,4 @@ data class A(
|
|||||||
// LINES(JS): 1 2 3 * 1 2 2 1 3 3 1 1 1 2 3 1 1 1 2 3 1 1 1 2 3 1 1 1 1 1 2 3
|
// LINES(JS): 1 2 3 * 1 2 2 1 3 3 1 1 1 2 3 1 1 1 2 3 1 1 1 2 3 1 1 1 1 1 2 3
|
||||||
|
|
||||||
// FIXME: componentN function body should point to the corresponding property.
|
// FIXME: componentN function body should point to the corresponding property.
|
||||||
// LINES(JS_IR): 2 2 3 3 * 2 2 * 3 3 * 1 1 * 1 1 * 1 1 * 1 1 1 1 * 1 1 * 1 1 1 1 1 1 * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
// LINES(JS_IR): 1 2 2 3 3 2 2 2 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ class Delegate(val f: () -> Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 3 * 2 2 3 3 3 3 * 6 8 7 7 10 10 11 13 12 12
|
// LINES(JS): 1 2 3 * 2 2 3 3 3 3 * 6 8 7 7 10 10 11 13 12 12
|
||||||
// LINES(JS_IR): 3 3 * 3 3 3 * 3 3 2 1 2 * 7 7 * 10 10 * 10 10 * 12 12 * 2
|
// LINES(JS_IR): 3 3 3 1 3 3 3 2 3 3 2 1 2 6 7 7 10 10 10 10 10 10 11 12 12 2 2
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ class B {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14
|
// LINES(JS): 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14
|
||||||
// LINES(JS_IR): 5 5 * 5 5 4 1 4 5 * 5 5 4 1 4 * 10 10 * 14 14 * 4 * 4
|
// LINES(JS_IR): 3 5 5 4 5 5 4 1 4 5 4 5 5 4 1 4 8 9 10 10 13 14 14 4 4 * 4 4
|
||||||
|
|||||||
+1
-1
@@ -19,4 +19,4 @@ val o = object : I {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 3 2 2 2 2 2 2 2 * 11 12 12 12 15 15 15 16 18 17 17
|
// LINES(JS): 1 2 3 2 2 2 2 2 2 2 * 11 12 12 12 15 15 15 16 18 17 17
|
||||||
// LINES(JS_IR): 11 11 * 3 3 * 1 1 * 1 1 * 1 1 * 12 12 * 17 17 * 15 15 * 11
|
// LINES(JS_IR): 11 11 11 * 1 3 3 1 1 1 1 1 1 1 1 1 * 11 12 12 12 16 17 17 15 15 15 11
|
||||||
|
|||||||
+1
-1
@@ -28,4 +28,4 @@ fun bar(f: (Pair<String, String>) -> Unit) {
|
|||||||
|
|
||||||
|
|
||||||
// LINES(JS): 15 22 16 16 17 18 20 20 21 21 22 22 3 23 9 9 9 9 4 9 9 9 5 5 6 7 11 11 12 12 15 15 25 27 26 26 * 1 * 1
|
// LINES(JS): 15 22 16 16 17 18 20 20 21 21 22 22 3 23 9 9 9 9 4 9 9 9 5 5 6 7 11 11 12 12 15 15 25 27 26 26 * 1 * 1
|
||||||
// LINES(JS_IR): 1 1 * 1 1 * 9 9 9 9 9 6 6 9 7 7 9 11 11 12 12 15 15 * 26 26 * 17 17 16 18 18 16 20 20 21 21 * 1
|
// LINES(JS_IR): 1 1 1 1 1 1 * 3 9 9 9 9 9 6 6 9 7 7 9 11 11 12 12 15 15 25 26 26 15 17 17 16 18 18 16 20 20 21 21 * 1
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ inline operator fun P.component1() = a
|
|||||||
inline operator fun P.component2() = b
|
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): 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 * 9 9 9 9 9 * 31 31 9 6 6 * 33 33 9 7 7 11 11 12 12 15 15 * 26 26 * 29 29 29 29 * 29 29 * 29 29 * 31 31 * 33 33 * 31 31 16 17 17 * 33 33 16 18 18 20 20 21 21 * 1
|
// LINES(JS_IR): 1 1 1 1 1 1 * 3 9 9 9 9 9 * 31 31 9 6 6 * 33 33 9 7 7 11 11 12 12 15 15 25 26 26 29 29 29 29 29 29 29 29 29 29 29 31 31 31 33 33 33 15 * 31 31 16 17 17 * 33 33 16 18 18 20 20 21 21 * 1
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ fun box() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 14 8 8 7 3 2 2 3 3 3 8 8 11 11 * 3 7 12 3 3 4 4
|
// LINES(JS): 1 14 8 8 7 3 2 2 3 3 3 8 8 11 11 * 3 7 12 3 3 4 4
|
||||||
// LINES(JS_IR): 2 2 4 4 * 8 8 8 8 8 11 11 * 7 12
|
// LINES(JS_IR): 1 2 2 4 4 * 8 8 8 8 8 11 11 * 7 12
|
||||||
|
|||||||
+1
-1
@@ -10,4 +10,4 @@ fun box(x: String?) {
|
|||||||
fun foo() = "bar"
|
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): 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 * 4 5 5 * 5 * 7 7 7 * 5 4 4 * 10 10 * 1
|
// LINES(JS_IR): 1 1 1 1 1 1 * 3 4 5 5 * 5 * 7 7 7 * 5 4 4 10 10 10 * 1
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ enum class Foo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 * 2 2 2 2 4 4 5 5 * 4 4 4 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1
|
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 * 2 2 2 2 4 4 5 5 * 4 4 4 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1
|
||||||
// LINES(JS_IR): 5 5 * 5 5
|
// LINES(JS_IR): 4 * 5 5 5 5 5 * 1 * 1 * 1
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ enum class E {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 8 * 2 2 2 2 4 4 4 5 5 5 * 4 4 4 4 8 8 8 9 9 9 * 8 8 8 8 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1
|
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 8 * 2 2 2 2 4 4 4 5 5 5 * 4 4 4 4 8 8 8 9 9 9 * 8 8 8 8 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1
|
||||||
// LINES(JS_IR): 5 5 * 9 9
|
// LINES(JS_IR): 4 * 5 5 5 * 8 * 9 9 9 * 1 * 1 * 1
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ fun foo() =
|
|||||||
23
|
23
|
||||||
|
|
||||||
// LINES(JS): 1 2 2 4 5 5
|
// LINES(JS): 1 2 2 4 5 5
|
||||||
// LINES(JS_IR): 2 2 * 5 5
|
// LINES(JS_IR): 1 2 2 4 5 5
|
||||||
|
|||||||
+1
-1
@@ -18,4 +18,4 @@ 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): 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): 12 2 18 18 35 35 2 2 2 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 6 10 10 10 10 10 11 11 14 14 15 15 15 15 15 15 15 15 15 16 16 15
|
// LINES(JS_IR): 1 * 12 2 18 18 35 35 2 2 2 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 6 10 10 10 10 10 11 11 14 14 15 15 15 15 15 15 15 15 15 16 16 15
|
||||||
|
|||||||
+1
-1
@@ -9,4 +9,4 @@ fun foo(x: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 9 2 2 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): 2 2 3 3 3 3 4 4 5 5 6 6 7 7 8 8
|
// LINES(JS_IR): 1 2 2 3 3 3 3 4 4 5 5 6 6 7 7 8 8
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ inline fun foo(x: Int) {
|
|||||||
fun bar() = 23
|
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): 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 * 4 4 8 8 9 9 * 8 8 9 9 * 12 12 * 1
|
// LINES(JS_IR): 1 1 1 1 1 1 * 3 * 4 4 8 8 9 9 7 8 8 9 9 12 12 12 * 1
|
||||||
|
|||||||
@@ -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): 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): 2 2 3 4 4 * 2 2 3 4 4
|
// LINES(JS_IR): 1 2 2 3 4 4 8 * 2 2 3 4 4
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ inline fun foo(x: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 6 6 6 6 6 9 7 7 8 8
|
// LINES(JS): 6 6 6 6 6 9 7 7 8 8
|
||||||
// LINES(JS_IR): 7 7 8 8
|
// LINES(JS_IR): 6 7 7 8 8
|
||||||
|
|
||||||
// MODULE: main(lib)
|
// MODULE: main(lib)
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
@@ -23,4 +23,4 @@ fun box() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 6 20 23 7 7 21 7 8 8 21 8 7 7 22 7 8 8 22 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): 7 7 8 8 * 7 7 8 8
|
// LINES(JS_IR): 20 * 7 7 8 8 * 7 7 8 8
|
||||||
|
|||||||
+1
-1
@@ -22,4 +22,4 @@ fun bar(x: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 1 1 1 1 1 1 1 17 2 2 3 3 4 7 7 9 9 10 10 11 14 14 16 16 19 22 20 20 20 20 17 2 2 3 3 4 3 7 7 9 9 10 10 11 10 14 14 16 16 20 21 21
|
// LINES(JS): 1 1 1 1 1 1 1 1 1 17 2 2 3 3 4 7 7 9 9 10 10 11 14 14 16 16 19 22 20 20 20 20 17 2 2 3 3 4 3 7 7 9 9 10 10 11 10 14 14 16 16 20 21 21
|
||||||
// LINES(JS_IR): 2 3 3 4 7 7 9 10 10 11 14 14 16 16 * 20 20 2 3 3 4 * 7 7 9 10 10 11 * 14 14 16 16 20 20 21 21
|
// LINES(JS_IR): 1 2 3 3 4 7 7 9 10 10 11 14 14 16 16 19 * 20 20 2 3 3 4 * 7 7 9 10 10 11 * 14 14 16 16 20 20 21 21
|
||||||
|
|||||||
+2
-2
@@ -11,5 +11,5 @@ inline fun bar() {
|
|||||||
println("bar2")
|
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): 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): 2 2 * 10 10 11 11 4 4 * 10 10 11 11 6 6 * 10 10 11 11
|
// LINES(JS_IR): 1 2 2 * 10 10 11 11 4 4 * 10 10 11 11 6 6 9 10 10 11 11
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ inline fun foo(f: () -> Unit) {
|
|||||||
println("after")
|
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): 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): 2 2 * 14 14 * 4 4 16 16 6 6 * 14 14 * 8 8 16 16 10 10 * 14 14 15 15 16 16
|
// LINES(JS_IR): 1 2 2 * 14 14 * 4 4 16 16 6 6 * 14 14 * 8 8 16 16 10 10 13 14 14 15 15 16 16
|
||||||
|
|||||||
+2
-2
@@ -6,5 +6,5 @@ class A(val x: Int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 2 2 3 5 4 4
|
// LINES(JS): 1 1 2 2 3 5 4 4
|
||||||
// LINES(JS_IR): 2 2 * 4 4 * 1 1 * 1 1
|
// LINES(JS_IR): 2 2 2 3 4 4 1 1 1 1 1 1
|
||||||
|
|||||||
+2
-2
@@ -11,5 +11,5 @@ inline fun foo(): Boolean {
|
|||||||
return true
|
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): 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 * 4 * 10 10 11 11 4 4 * 5 5 * 10 10 11 11 * 1
|
// LINES(JS_IR): 1 1 1 1 1 1 * 3 * 4 * 10 10 11 11 4 4 * 5 5 9 10 10 11 11 * 1
|
||||||
|
|||||||
+1
-1
@@ -6,4 +6,4 @@ fun foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 6 2 2 3 3 4 4 5 5
|
// LINES(JS): 1 6 2 2 3 3 4 4 5 5
|
||||||
// LINES(JS_IR): 2 2 3 3 4 4 5 5
|
// LINES(JS_IR): 1 2 2 3 3 4 4 5 5
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ fun foo(x: Int): () -> Unit = {
|
|||||||
fun bar() = 23
|
fun bar() = 23
|
||||||
|
|
||||||
// LINES(JS): 1 1 1 3 2 2 3 3 1 1 1 5 5 5
|
// LINES(JS): 1 1 1 3 2 2 3 3 1 1 1 5 5 5
|
||||||
// LINES(JS_IR): 3 3 1 * 5 5 * 2 2
|
// LINES(JS_IR): 1 3 3 1 5 5 5 1 1 2 2
|
||||||
|
|||||||
@@ -24,5 +24,5 @@ fun baz() = "baz"
|
|||||||
|
|
||||||
fun boo() = "boo"
|
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): 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): 4 * 7 * 3 20 20 * 12 12 12 13 14 20 20 * 20 20 * 23 23 * 25 25
|
// LINES(JS_IR): 1 * 4 * 7 * 3 20 20 * 12 12 12 13 14 20 20 19 20 20 23 23 23 25 25 25
|
||||||
|
|||||||
+1
-1
@@ -27,4 +27,4 @@ fun bar(vararg x: Any?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 22 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 25 27 26 26
|
// LINES(JS): 1 2 22 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 25 27 26 26
|
||||||
// LINES(JS_IR): 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 26 26
|
// LINES(JS_IR): 1 2 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 25 26 26
|
||||||
|
|||||||
+1
-1
@@ -6,4 +6,4 @@ fun foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 3 * 5 1 6 2 4
|
// LINES(JS): 3 * 5 1 6 2 4
|
||||||
// LINES(JS_IR): 2 4
|
// LINES(JS_IR): 1 2 4
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ class B : A() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 2 2 2 2 2 2 2 2 4 4 4 * 7 7 8 10 9 9
|
// LINES(JS): 1 2 2 2 2 2 2 2 2 2 4 4 4 * 7 7 8 10 9 9
|
||||||
// LINES(JS_IR): 2 2 * 2 2 2 * 4 4 * 7 * 9 9
|
// LINES(JS_IR): 1 2 2 2 2 2 2 2 4 4 4 7 7 8 9 9
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ object O {
|
|||||||
val y = 23
|
val y = 23
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 9 2 2 3 3 4 4 6 6 7 7 8 8 11 11 12 12 * 11 11 11 11 11 11
|
// LINES(JS): 1 9 2 2 3 3 4 4 6 6 7 7 8 8 11 11 12 12 * 11 11 11 11 11 11
|
||||||
// LINES(JS_IR): 2 2 3 3 4 4 6 6 7 7 8 8 * 12 12 * 12 12
|
// LINES(JS_IR): 1 2 2 3 3 4 4 6 6 7 7 8 8 11 * 12 12 12 12 12
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ fun foo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 * 1 1 1 1 1 1 3 5 4 4
|
// LINES(JS): 1 1 * 1 1 1 1 1 1 3 5 4 4
|
||||||
// LINES(JS_IR): 4 4
|
// LINES(JS_IR): 1 * 3 4 4
|
||||||
|
|||||||
+2
-2
@@ -7,5 +7,5 @@ fun box(
|
|||||||
println(y)
|
println(y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7
|
// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7
|
||||||
// LINES(JS_IR): 1 2 1 1 4 1 6 6 7 7
|
// LINES(JS_IR): 1 1 2 1 1 4 1 6 6 7 7
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ open class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 4 7 7 8 8 4 4 4
|
// LINES(JS): 1 2 4 7 7 8 8 4 4 4
|
||||||
// LINES(JS_IR): 7 7 8 8 * 2 2 * 4 4
|
// LINES(JS_IR): 1 7 7 8 8 2 2 2 4 4 4
|
||||||
|
|||||||
+1
-1
@@ -4,4 +4,4 @@ fun box() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 4 2 2 3 3
|
// LINES(JS): 1 4 2 2 3 3
|
||||||
// LINES(JS_IR): 2 2 3 3
|
// LINES(JS_IR): 1 2 2 3 3
|
||||||
|
|||||||
+1
-1
@@ -5,4 +5,4 @@ fun box(x: Int): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 5 2 2 3 4
|
// LINES(JS): 1 5 2 2 3 4
|
||||||
// LINES(JS_IR): 2 2 3 4
|
// LINES(JS_IR): 1 2 2 3 4
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ class C : A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 3 * 1 1 1 1 1 1 7 * 9 10 11 * 15 15 16 17 14 19 15 15 22 22 23 24 22 22
|
// LINES(JS): 1 1 3 * 1 1 1 1 1 1 7 * 9 10 11 * 15 15 16 17 14 19 15 15 22 22 23 24 22 22
|
||||||
// LINES(JS_IR): 3 * 10 11 * 16 17 15 19 * 23 24 23
|
// LINES(JS_IR): 1 * 3 * 7 9 10 11 16 17 15 19 * 23 24 23
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ enum class E {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 3 3 4 * 2 2 2 2 * 3 3 3 3 4 4 4 6 6 * 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1
|
// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 3 3 4 * 2 2 2 2 * 3 3 3 3 4 4 4 6 6 * 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1
|
||||||
// LINES(JS_IR): 6 6
|
// LINES(JS_IR): 4 * 6 6 * 1 * 1 * 1
|
||||||
|
|||||||
+2
-2
@@ -7,5 +7,5 @@ fun foo() {
|
|||||||
A(23, "foo")
|
A(23, "foo")
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 2 3 * 6 8 7 7
|
// LINES(JS): 1 2 3 * 6 8 7 7
|
||||||
// LINES(JS_IR): 2 2 3 3 * 2 2 * 3 3 * 7 7
|
// LINES(JS_IR): 1 2 2 3 3 2 2 2 3 3 3 6 7 7
|
||||||
|
|||||||
@@ -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): 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2
|
||||||
// LINES(JS_IR): 4 4 2 6 7 8 9 11 12 13 16
|
// LINES(JS_IR): 1 4 4 2 6 7 8 9 11 12 13 16
|
||||||
|
|||||||
+1
-1
@@ -29,4 +29,4 @@ fun four() = 4
|
|||||||
fun five() = 5
|
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): 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): 4 4 2 6 7 8 9 11 12 13 16 * 21 21 * 23 23 * 25 25 * 27 27 * 29 29
|
// LINES(JS_IR): 1 4 4 2 6 7 8 9 11 12 13 16 21 21 21 23 23 23 25 25 25 27 27 27 29 29 29
|
||||||
|
|||||||
+1
-1
@@ -14,4 +14,4 @@ fun foo(): Int = 23
|
|||||||
fun bar(): IntRange = 1000..2000
|
fun bar(): IntRange = 1000..2000
|
||||||
|
|
||||||
// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 7 7 8 8 12 12 12 14 14 14
|
// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 7 7 8 8 12 12 12 14 14 14
|
||||||
// LINES(JS_IR): 2 2 3 4 4 5 6 6 7 7 7 7 7 8 8 * 12 12 * 14 14
|
// LINES(JS_IR): 1 2 2 3 4 4 5 6 6 7 7 7 7 7 8 8 12 12 12 14 14 14
|
||||||
|
|||||||
+1
-1
@@ -14,4 +14,4 @@ open class A
|
|||||||
open class B : A()
|
open class B : A()
|
||||||
|
|
||||||
// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 8 8 12 * 14 14
|
// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 8 8 12 * 14 14
|
||||||
// LINES(JS_IR): 2 2 3 4 4 5 6 6 8 8 * 14
|
// LINES(JS_IR): 1 2 2 3 4 4 5 6 6 8 8 12 14 14
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ fun box() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LINES(JS): 1 13 5 5 4 2 2 3 5 5 8 8 * 3 4 9 3 11 11
|
// LINES(JS): 1 13 5 5 4 2 2 3 5 5 8 8 * 3 4 9 3 11 11
|
||||||
// LINES(JS_IR): 2 2 * 5 5 5 5 5 8 8 * 4 9 * 11 11
|
// LINES(JS_IR): 1 2 2 * 5 5 5 5 5 8 8 * 4 9 * 11 11
|
||||||
|
|||||||
Reference in New Issue
Block a user