[JS IR] Improve debug info precision for blocks

Namely:
- Generate debug info for closing braces, which allows the breakpoints
  set on closing braces to be hit
- Generate debug info for 'if' and 'try/catch' statements.

KT-46276
This commit is contained in:
Sergej Jaskiewicz
2022-10-13 19:15:49 +02:00
committed by Space Team
parent a1c61bb9a0
commit a939f9ccd0
129 changed files with 423 additions and 160 deletions
@@ -353,11 +353,13 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
lambdaContextMapping: Map<IrFieldSymbol, IrValueSymbol>,
outerReceiverMapping: Map<IrFieldSymbol, IrGetField> = emptyMap()
): IrBlockBody {
val body = invokeFun.body
val oldBody = invokeFun.body as? IrBlockBody
?: compilationException(
"invoke() method has to have a body",
invokeFun
)
// Don't use offsets from oldBody, use offsets from invokeFun instead. This is more precise.
val body = context.irFactory.createBlockBody(invokeFun.startOffset, invokeFun.endOffset, oldBody.statements)
fun IrExpression.getValue(d: IrValueSymbol): IrExpression = IrGetValueImpl(startOffset, endOffset, d)
fun IrExpression.getCastedValue(d: IrValueSymbol, toType: IrType): IrExpression =
@@ -406,10 +408,20 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
if (invokeFun.returnType.isUnit()) {
val unitValue = JsIrBuilder.buildGetObjectValue(context.irBuiltIns.unitType, context.irBuiltIns.unitClass)
(body as IrBlockBody).statements.add(IrReturnImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, context.irBuiltIns.nothingType, lambdaDeclaration.symbol, unitValue))
// Set both offsets of the IrReturn to body.endOffset - 1 so that a breakpoint set at the closing brace of a lambda expression
// could be hit.
body.statements.add(
IrReturnImpl(
body.endOffset - 1,
body.endOffset - 1,
context.irBuiltIns.nothingType,
lambdaDeclaration.symbol,
unitValue
)
)
}
return body as IrBlockBody
return body
}
private fun buildLambdaBody(instance: IrVariable, lambdaDeclaration: IrSimpleFunction, invokeFun: IrSimpleFunction): IrBlockBody {
@@ -32,7 +32,7 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer<JsSta
}
override fun visitBlockBody(body: IrBlockBody, context: JsGenerationContext): JsStatement {
return JsBlock(body.statements.map { it.accept(this, context) })
return JsBlock(body.statements.map { it.accept(this, context) }).withSource(body, context, container = context.currentFunction)
}
override fun visitBlock(expression: IrBlock, context: JsGenerationContext): JsStatement {
@@ -53,7 +53,7 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer<JsSta
}
} else {
JsBlock(statements)
}
}.withSource(expression, context)
}
private fun List<JsStatement>.wrapInCommentsInlineFunctionCall(expression: IrReturnableBlock): List<JsStatement> {
@@ -65,7 +65,7 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer<JsSta
}
override fun visitComposite(expression: IrComposite, context: JsGenerationContext): JsStatement {
return JsBlock(expression.statements.map { it.accept(this, context) })
return JsBlock(expression.statements.map { it.accept(this, context) }).withSource(expression, context)
}
override fun visitExpression(expression: IrExpression, context: JsGenerationContext): JsStatement {
@@ -186,12 +186,12 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer<JsSta
val jsCatch = aTry.catches.singleOrNull()?.let {
val name = context.getNameForValueDeclaration(it.catchParameter)
val jsCatchBlock = it.result.accept(this, context)
JsCatch(emptyScope, name.ident, jsCatchBlock)
JsCatch(emptyScope, name.ident, jsCatchBlock).withSource(it, context)
}
val jsFinallyBlock = aTry.finallyExpression?.accept(this, context)?.asBlock()
return JsTry(jsTryBlock, jsCatch, jsFinallyBlock)
return JsTry(jsTryBlock, jsCatch, jsFinallyBlock).withSource(aTry, context)
}
override fun visitWhen(expression: IrWhen, context: JsGenerationContext): JsStatement {
@@ -45,16 +45,16 @@ fun jsVar(name: JsName, initializer: IrExpression?, context: JsGenerationContext
fun <T : JsNode> IrWhen.toJsNode(
tr: BaseIrElementToJsNodeTransformer<T, JsGenerationContext>,
data: JsGenerationContext,
context: JsGenerationContext,
node: (JsExpression, T, T?) -> T,
implicitElse: T? = null
): T? =
branches.foldRight(implicitElse) { br, n ->
val body = br.result.accept(tr, data)
val body = br.result.accept(tr, context)
if (isElseBranch(br)) body
else {
val condition = br.condition.accept(IrElementToJsExpressionTransformer(), data)
node(condition, body, n)
val condition = br.condition.accept(IrElementToJsExpressionTransformer(), context)
node(condition, body, n).withSource(br, context)
}
}
@@ -521,25 +521,46 @@ object JsAstUtils {
}
}
internal fun <T : JsNode> T.withSource(node: IrElement, context: JsGenerationContext, useNameOf: IrDeclarationWithName? = null): T {
addSourceInfoIfNeed(node, context, useNameOf)
internal fun <T : JsNode> T.withSource(
node: IrElement,
context: JsGenerationContext,
useNameOf: IrDeclarationWithName? = null,
container: IrDeclaration? = null
): T {
addSourceInfoIfNeed(node, context, useNameOf, container)
return this
}
@Suppress("NOTHING_TO_INLINE")
private inline fun <T : JsNode> T.addSourceInfoIfNeed(node: IrElement, context: JsGenerationContext, useNameOf: IrDeclarationWithName?) {
private inline fun <T : JsNode> T.addSourceInfoIfNeed(
node: IrElement,
context: JsGenerationContext,
useNameOf: IrDeclarationWithName?,
container: IrDeclaration?
) {
val sourceMapsInfo = context.staticContext.backendContext.sourceMapsInfo ?: return
val originalName = useNameOf?.originalNameForUseInSourceMap(sourceMapsInfo.namesPolicy)
val location = context.getLocationForIrElement(node, originalName) ?: return
val location = context.getStartLocationForIrElement(node, originalName) ?: return
val isNodeFromCurrentModule = context.currentFile.module.descriptor == context.staticContext.backendContext.module
// TODO maybe it's better to fix in JsExpressionStatement
val locationTarget = if (this is JsExpressionStatement) this.expression else this
if (locationTarget is JsBlock && (node is IrBlockBody || node is IrBlock)) {
locationTarget.closingBraceSource = if (container is IrConstructor) {
// This is a hack. Without this special case, the closing brace in the generated code for constructors would always be mapped
// to the closing brace of the Kotlin class declaration.
context.getStartLocationForIrElement(node)
} else {
context.getEndLocationForIrElement(node)?.run {
// Assuming that endOffset for IrBlock and IrBlockBody points to the character after the closing brace.
// TODO: This doesn't produce good results if the node originates from an expression body
// (meaning, in the source code; not to be confused with IrExpressionBody)
if (startChar > 0) copy(startChar = startChar - 1) else null
}
}
}
locationTarget.source = when (sourceMapsInfo.sourceMapContentEmbedding) {
SourceMapSourceEmbedding.NEVER -> location
SourceMapSourceEmbedding.INLINING -> if (isNodeFromCurrentModule) location else location.withEmbeddedSource(context)
@@ -568,16 +589,20 @@ private fun JsLocation.withEmbeddedSource(
}
}
fun IrElement.getSourceInfo(container: IrDeclaration): JsLocation? {
fun IrElement.getStartSourceLocation(container: IrDeclaration): JsLocation? {
val fileEntry = container.fileOrNull?.fileEntry ?: return null
return getSourceInfo(fileEntry)
return getStartSourceLocation(fileEntry)
}
fun IrElement.getSourceInfo(fileEntry: IrFileEntry): JsLocation? {
fun IrElement.getStartSourceLocation(fileEntry: IrFileEntry) =
getSourceLocation(fileEntry) { startOffset }
inline fun IrElement.getSourceLocation(fileEntry: IrFileEntry, offsetSelector: IrElement.() -> Int): JsLocation? {
if (startOffset == UNDEFINED_OFFSET || endOffset == UNDEFINED_OFFSET) return null
val path = fileEntry.name
val startLine = fileEntry.getLineNumber(startOffset)
val startColumn = fileEntry.getColumnNumber(startOffset)
val offset = offsetSelector()
val startLine = fileEntry.getLineNumber(offset)
val startColumn = fileEntry.getColumnNumber(offset)
return JsLocation(path, startLine, startColumn)
}
@@ -28,14 +28,14 @@ fun translateJsCodeIntoStatementList(code: IrExpression, context: JsIrBackendCon
translateJsCodeIntoStatementList(
code,
context,
code.getSourceInfo(container) ?: container.fileOrNull?.fileEntry?.let { JsLocation(it.name, 0, 0) }
code.getStartSourceLocation(container) ?: container.fileOrNull?.fileEntry?.let { JsLocation(it.name, 0, 0) }
)
/**
* Returns null if constant expression could not be parsed.
*/
fun translateJsCodeIntoStatementList(code: IrExpression, context: JsIrBackendContext?, fileEntry: IrFileEntry) =
translateJsCodeIntoStatementList(code, context, code.getSourceInfo(fileEntry) ?: JsLocation(fileEntry.name, 0, 0))
translateJsCodeIntoStatementList(code, context, code.getStartSourceLocation(fileEntry) ?: JsLocation(fileEntry.name, 0, 0))
private fun translateJsCodeIntoStatementList(
code: IrExpression,
@@ -6,7 +6,8 @@
package org.jetbrains.kotlin.ir.backend.js.utils
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.getSourceInfo
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.getSourceLocation
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.getStartSourceLocation
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrLoop
import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock
@@ -33,7 +34,8 @@ class JsGenerationContext(
private val nameCache: MutableMap<IrElement, JsName> = mutableMapOf(),
private val useBareParameterNames: Boolean = false,
) : IrNamer by staticContext {
private val locationCache = mutableMapOf<Int, JsLocation>()
private val startLocationCache = mutableMapOf<Int, JsLocation>()
private val endLocationCache = mutableMapOf<Int, JsLocation>()
fun newFile(file: IrFile, func: IrFunction? = null, localNames: LocalNameGenerator? = null): JsGenerationContext {
return JsGenerationContext(
@@ -87,9 +89,18 @@ class JsGenerationContext(
fun checkIfHasAssociatedJsCode(symbol: IrFunctionSymbol): Boolean = staticContext.backendContext.getJsCodeForFunction(symbol) != null
fun getLocationForIrElement(irElement: IrElement, originalName: String? = null): JsLocation? {
return locationCache.getOrPut(irElement.startOffset) {
irElement.getSourceInfo(currentFile.fileEntry) ?: return null
}.copy(name = originalName)
}
fun getStartLocationForIrElement(irElement: IrElement, originalName: String? = null) =
getLocationForIrElement(irElement, originalName, startLocationCache) { startOffset }
fun getEndLocationForIrElement(irElement: IrElement, originalName: String? = null) =
getLocationForIrElement(irElement, originalName, endLocationCache) { endOffset }
private inline fun getLocationForIrElement(
irElement: IrElement,
originalName: String?,
cache: MutableMap<Int, JsLocation>,
offsetSelector: IrElement.() -> Int,
): JsLocation? = cache.getOrPut(irElement.offsetSelector()) {
irElement.getSourceLocation(currentFile.fileEntry, offsetSelector) ?: return null
}.copy(name = originalName)
}
+1
View File
@@ -18,3 +18,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:2 cond
// test.kt:9 box
+2 -1
View File
@@ -19,4 +19,5 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:6 box
// test.kt:3 eval
// test.kt:7 box$lambda
// test.kt:7 box$lambda
// test.kt:9 box
@@ -18,3 +18,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:5 box$lambda
// test.kt:7 box
@@ -44,3 +44,5 @@ fun box() {
// test.kt:6 alternate
// test.kt:7 alternate
// test.kt:13 foo
// test.kt:16 foo
// test.kt:20 box
@@ -34,9 +34,14 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:8 box
// test.kt:3 <init>
// test.kt:9 box
// test.kt:5 bar
// test.kt:3 <init>
// test.kt:10 box
// test.kt:5 bar
// test.kt:3 <init>
// test.kt:9 box
// test.kt:5 bar
// test.kt:3 <init>
// test.kt:14 box
+3 -1
View File
@@ -29,6 +29,8 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:9 box
// test.kt:3 <init>
// test.kt:11 box
// test.kt:4 foo
// test.kt:5 box
// test.kt:5 box
// test.kt:15 box
+4 -2
View File
@@ -23,7 +23,9 @@ fun f(block: () -> Unit) {
// EXPECTATIONS JS_IR
// test.kt:3 box
// test.kt:4 box
// test.kt:4 box$lambda
// test.kt:4 box
// test.kt:10 f
// test.kt:5 box$lambda$lambda
// test.kt:5 box$lambda$lambda
// test.kt:6 box$lambda$lambda
// test.kt:11 f
// test.kt:7 box
+3 -1
View File
@@ -31,10 +31,12 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:9 box
// test.kt:3 <init>
// test.kt:10 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:5 box
// test.kt:15 box
+4 -1
View File
@@ -37,4 +37,7 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:12 box
// test.kt:4 <init>
// test.kt:14 box
// test.kt:3 <init>
// test.kt:14 box
// test.kt:8 foo
// test.kt:15 box
+3 -1
View File
@@ -42,7 +42,9 @@ fun box() {
// test.kt:14 box
// test.kt:5 <init>
// test.kt:6 <init>
// test.kt:4 <init>
// test.kt:15 box
// test.kt:16 box
// test.kt:16 box
// test.kt:8 foo
// test.kt:8 foo
// test.kt:17 box
@@ -12,3 +12,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:6 box
+1
View File
@@ -34,3 +34,4 @@ fun getD() = true
// EXPECTATIONS JS_IR
// test.kt:3 box
// test.kt:11 box
@@ -27,3 +27,4 @@ fun test(): Long {
// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:11 test
// test.kt:6 box
+6 -1
View File
@@ -35,9 +35,14 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:6 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:7 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:10 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:12 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:14 box
+15 -1
View File
@@ -187,35 +187,49 @@ class O<T>(i: T) {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:19 <init>
// test.kt:5 box
// test.kt:20 <init>
// test.kt:20 <init>
// test.kt:6 box
// test.kt:22 D_init_$Init$
// test.kt:21 D
// test.kt:7 box
// test.kt:25 E_init_$Init$
// test.kt:24 E
// test.kt:8 box
// test.kt:28 F_init_$Init$
// test.kt:27 F
// test.kt:29 F_init_$Init$
// test.kt:9 box
// test.kt:33 G_init_$Init$
// test.kt:32 G
// test.kt:34 G_init_$Init$
// test.kt:10 box
// test.kt:39 <init>
// test.kt:37 <init>
// test.kt:11 box
// test.kt:42 <init>
// test.kt:44 <init>
// test.kt:42 <init>
// test.kt:12 box
// test.kt:48 L_init_$Init$
// test.kt:53 L
// test.kt:47 L
// test.kt:49 L_init_$Init$
// test.kt:13 box
// test.kt:57 M_init_$Init$
// test.kt:61 M_init_$Init$_0
// test.kt:56 M
// test.kt:58 M_init_$Init$
// test.kt:14 box
// test.kt:65 N_init_$Init$
// test.kt:69 N_init_$Init$_0
// test.kt:64 N
// test.kt:66 N_init_$Init$
// test.kt:15 box
// test.kt:72 <init>
// test.kt:16 box
// test.kt:73 O_init_$Init$
// test.kt:73 O_init_$Init$
// test.kt:72 <init>
// test.kt:17 box
+8 -2
View File
@@ -64,9 +64,11 @@ fun box() {
// test.kt:13 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:14 box
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:14 box
// test.kt:1 equals
// test.kt:1 equals
@@ -87,16 +89,18 @@ fun box() {
// test.kt:18 box
// test.kt:1 copy$default
// test.kt:1 copy$default
// test.kt:1 copy$default
// test.kt:1 copy
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:3 <init>
// test.kt:19 box
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:20 box
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:20 box
// test.kt:7 equals
// test.kt:21 box
@@ -111,4 +115,6 @@ fun box() {
// test.kt:24 box
// test.kt:9 copy
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:5 <init>
// test.kt:25 box
+4 -2
View File
@@ -25,9 +25,11 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:11 box
// test.kt:3 <init>
// test.kt:11 box
// test.kt:6 foo$default
// test.kt:4 computeParam
// test.kt:6 foo$default
// test.kt:6 foo$default
// test.kt:6 foo$default
// test.kt:7 foo
// test.kt:6 foo$default
// test.kt:12 box
+6 -2
View File
@@ -55,11 +55,15 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:22 box
// test.kt:11 <init>
// test.kt:3 <init>
// test.kt:11 <init>
// test.kt:3 <init>
// test.kt:22 box
// test.kt:9 foo
// test.kt:7 E$foo$lambda
// test.kt:15 E2_initEntries
// test.kt:14 <init>
// test.kt:14 <init>
// test.kt:17 E2_initEntries
// test.kt:14 <init>
// test.kt:14 <init>
// test.kt:14 <init>
// test.kt:24 box
+1
View File
@@ -31,3 +31,4 @@ inline fun foo(n: Int) {}
// test.kt:3 box
// test.kt:3 box
// test.kt:3 box
// test.kt:6 box
@@ -24,4 +24,5 @@ inline fun bar(i: Int = 1) {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:8 foo
// test.kt:8 foo
// test.kt:6 box
@@ -33,6 +33,11 @@ fun foo(f: () -> Unit) {
// test.kt:4 box
// test.kt:14 foo
// test.kt:5 box$lambda
// test.kt:6 box$lambda
// test.kt:15 foo
// test.kt:8 box
// test.kt:14 foo
// test.kt:9 box$lambda
// test.kt:9 box$lambda
// test.kt:10 box$lambda
// test.kt:15 foo
// test.kt:11 box
@@ -43,3 +43,4 @@ fun bar(x: Int) =
// foo.kt:4 foo
// foo.kt:5 foo
// test.kt:21 bar
// test.kt:14 box
+3
View File
@@ -43,7 +43,10 @@ fun 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
+2
View File
@@ -31,3 +31,5 @@ fun box() {
// test.kt:13 box
// test.kt:14 box
// test.kt:4 foo
// test.kt:7 foo
// test.kt:15 box
+3
View File
@@ -46,9 +46,12 @@ fun box() {
// test.kt:10 foo
// test.kt:11 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:21 box
// test.kt:22 box
// test.kt:4 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:23 box
+3
View File
@@ -39,9 +39,12 @@ fun box() {
// test.kt:15 box
// test.kt:8 foo
// test.kt:5 cond
// test.kt:12 foo
// test.kt:16 box
// test.kt:17 box
// test.kt:8 foo
// test.kt:5 cond
// test.kt:9 foo
// test.kt:5 cond
// test.kt:12 foo
// test.kt:18 box
@@ -58,15 +58,20 @@ fun nop() {}
// EXPECTATIONS JS_IR
// 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:10 box
// test.kt:11 box
// test.kt:30 nop
// test.kt:24 box
// test.kt:16 box
// test.kt:27 box
// test.kt:15 box
// test.kt:19 box
// test.kt:30 nop
// test.kt:21 box
+1
View File
@@ -56,3 +56,4 @@ fun box() {
// test.kt:12 box
// test.kt:14 box
// test.kt:16 box
// test.kt:18 box
+6 -1
View File
@@ -111,16 +111,21 @@ fun box() {
// test.kt:48 box
// test.kt:7 <init>
// test.kt:45 x
// test.kt:3 <init>
// test.kt:49 box
// test.kt:13 <init>
// test.kt:17 <init>
// test.kt:11 <init>
// test.kt:50 box
// test.kt:23 <init>
// test.kt:26 <init>
// test.kt:45 x
// test.kt:29 <init>
// test.kt:21 <init>
// test.kt:51 box
// test.kt:34 <init>
// test.kt:36 <init>
// test.kt:39 <init>
// test.kt:42 <init>
// test.kt:42 <init>
// test.kt:33 <init>
// test.kt:52 box
+3 -1
View File
@@ -60,4 +60,6 @@ fun box() {
// test.kt:13 <init>
// test.kt:16 <init>
// test.kt:21 <init>
// test.kt:30 box
// test.kt:4 <init>
// test.kt:30 box
// test.kt:31 box
@@ -39,3 +39,4 @@ inline fun f(block: () -> Unit) {
// test.kt:5 box
// test.kt:8 box
// test.kt:10 box
// test.kt:12 box
@@ -23,3 +23,5 @@ fun g() {}
// EXPECTATIONS JS_IR
// test.kt:3 box
// test.kt:8 box
// test.kt:11 g
// test.kt:5 box
+2
View File
@@ -57,6 +57,7 @@ fun box() {
// EXPECTATIONS
// test.kt:39 box
// test.kt:36 noop
// test.kt:41 box
// test.kt:42 box
// a.kt:11 box
@@ -78,3 +79,4 @@ fun box() {
// a.kt:6 exclamate
// a.kt:29 box
// a.kt:22 value
// test.kt:56 box
+2
View File
@@ -26,3 +26,5 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:12 box
// test.kt:9 makeFace
// test.kt:6 <init>
// test.kt:13 box
+4 -1
View File
@@ -28,4 +28,7 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:15 box
// test.kt:5 <init>
// test.kt:15 box
// test.kt:4 <init>
// test.kt:15 box
// test.kt:11 foo
// test.kt:16 box
+1
View File
@@ -21,3 +21,4 @@ inline fun foo() = {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test1.kt:6 box$lambda
// test.kt:5 box
+1
View File
@@ -28,3 +28,4 @@ inline fun foo() = {
// test.kt:4 box
// test.kt:5 box
// test1.kt:7 box$lambda
// test.kt:6 box
+4 -1
View File
@@ -41,8 +41,11 @@ fun baz(v:(() -> Unit)) {
// test.kt:4 box
// test3.kt:14 baz
// test1.kt:8 box$lambda
// test3.kt:15 baz
// test1.kt:11 box
// test.kt:5 box
// test.kt:6 box
// test3.kt:14 baz
// test1.kt:8 box$lambda
// test1.kt:8 box$lambda
// test3.kt:15 baz
// test.kt:7 box
@@ -40,5 +40,9 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:22 box
// test.kt:14 test1
// test.kt:23 box
// test.kt:17 test2
// test.kt:5 normalFunction
// test.kt:19 test2
// test.kt:24 box
+1
View File
@@ -29,3 +29,4 @@ fun box() {
// a.kt:4 a
// test.kt:15 box
// b.kt:8 b
// test.kt:16 box
@@ -25,3 +25,4 @@ fun test(a: Boolean, b: Boolean, c: Boolean): Boolean {
// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:9 test
// test.kt:6 box
@@ -17,3 +17,5 @@ fun foo(i: Int) {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:10 foo
// test.kt:7 box
@@ -17,3 +17,5 @@ infix fun Int.foo(i: Int) {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:9 foo
// test.kt:6 box
+4 -2
View File
@@ -32,8 +32,10 @@ fun g() {}
// EXPECTATIONS JS_IR
// test.kt:3 box
// test.kt:4 box
// test.kt:4 g$ref
// test.kt:4 box
// test.kt:8 f
// test.kt:4 g$ref$lambda
// test.kt:4 g$ref$lambda
// test.kt:11 g
// test.kt:4 g$ref$lambda
// test.kt:9 f
// test.kt:5 box
+1
View File
@@ -75,3 +75,4 @@ fun testExpressionBody(nullable: String?) =
// test.kt:21 testExpressionBody
// test.kt:9 box
// test.kt:21 testExpressionBody
// test.kt:10 box
+3 -1
View File
@@ -21,5 +21,7 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:11 box
// test.kt:3 <init>
// test.kt:11 box
// test.kt:6 <get-prop>
// test.kt:6 <get-prop>
// test.kt:12 box
+2
View File
@@ -17,3 +17,5 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:8 box
// test.kt:4 main
// test.kt:5 main
// test.kt:9 box
+1
View File
@@ -36,3 +36,4 @@ fun foo(n :Int ) : Int {
// test.kt:9 foo
// test.kt:11 foo
// test.kt:11 foo
// test.kt:5 box
@@ -41,7 +41,10 @@ fun fail() : String {
// 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
@@ -45,3 +45,4 @@ fun fail() : String {
// test.kt:14 box
// test.kt:9 box
// test.kt:3 execute
// test.kt:11 box
@@ -47,3 +47,4 @@ fun fail() : String {
// test.kt:16 box
// test.kt:8 box
// test.kt:16 box
// test.kt:9 box
@@ -43,3 +43,4 @@ fun fail() : String {
// test.kt:16 fail
// test.kt:12 box
// test.kt:7 box
// test.kt:9 box
+5
View File
@@ -119,21 +119,26 @@ fun box() {
// test.kt:12 stringSwitch
// test.kt:19 stringSwitch
// test.kt:21 stringSwitch
// test.kt:26 stringSwitch
// test.kt:30 box
// test.kt:6 stringSwitch
// test.kt:11 stringSwitch
// test.kt:13 stringSwitch
// test.kt:19 stringSwitch
// test.kt:22 stringSwitch
// test.kt:26 stringSwitch
// test.kt:31 box
// test.kt:7 stringSwitch
// test.kt:11 stringSwitch
// test.kt:14 stringSwitch
// test.kt:19 stringSwitch
// test.kt:23 stringSwitch
// test.kt:26 stringSwitch
// test.kt:32 box
// test.kt:8 stringSwitch
// test.kt:11 stringSwitch
// test.kt:15 stringSwitch
// test.kt:19 stringSwitch
// test.kt:24 stringSwitch
// test.kt:26 stringSwitch
// test.kt:33 box
@@ -102,15 +102,19 @@ fun box() {
// test.kt:11 stringSwitch
// test.kt:17 stringSwitch
// test.kt:19 stringSwitch
// test.kt:23 stringSwitch
// test.kt:27 box
// test.kt:6 stringSwitch
// test.kt:10 stringSwitch
// test.kt:12 stringSwitch
// test.kt:17 stringSwitch
// test.kt:20 stringSwitch
// test.kt:23 stringSwitch
// test.kt:28 box
// test.kt:7 stringSwitch
// test.kt:10 stringSwitch
// test.kt:13 stringSwitch
// test.kt:17 stringSwitch
// test.kt:21 stringSwitch
// test.kt:23 stringSwitch
// test.kt:29 box
+2 -1
View File
@@ -32,6 +32,7 @@ fun throwIfLess(a: Int, b: Int) {
// test.kt:6 box
// test.kt:14 throwIfLess
// test.kt:15 throwIfLess
// test.kt:7 box
// test.kt:8 box
// test.kt:14 throwIfLess
// test.kt:15 throwIfLess
// test.kt:15 throwIfLess
+1
View File
@@ -17,3 +17,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:8 box
// test.kt:3 foo
// test.kt:9 box
+3
View File
@@ -46,10 +46,13 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:14 box
// test.kt:14 <init>
// test.kt:14 box
// test.kt:7 bar
// test.kt:4 foo
// test.kt:15 box
// test.kt:11 <init>
// test.kt:15 box
// test.kt:7 bar
// test.kt:4 foo
// test.kt:16 box
+4
View File
@@ -32,6 +32,10 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:13 box
// test.kt:5 foo
// test.kt:10 foo
// test.kt:14 box
// test.kt:5 foo
// test.kt:5 foo
// test.kt:6 foo
// test.kt:10 foo
// test.kt:15 box
+5 -1
View File
@@ -79,13 +79,17 @@ fun box() {
// test.kt:29 box
// test.kt:5 foo
// test.kt:21 mightThrow
// test.kt:22 mightThrow
// test.kt:11 foo
// test.kt:25 mightThrow2
// test.kt:26 mightThrow2
// test.kt:10 foo
// test.kt:15 foo
// test.kt:30 box
// test.kt:31 box
// test.kt:5 foo
// test.kt:21 mightThrow
// test.kt:22 mightThrow
// test.kt:11 foo
// test.kt:25 mightThrow2
// test.kt:25 mightThrow2
// test.kt:25 mightThrow2
@@ -32,3 +32,4 @@ fun box() {
// test.kt:8 box
// test.kt:9 box
// test.kt:10 box
// test.kt:12 box
+8
View File
@@ -125,16 +125,24 @@ fun box() {
// test.kt:6 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:12 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:11 foo
// test.kt:6 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:12 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:19 box
@@ -53,10 +53,14 @@ fun box() {
// test.kt:6 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:13 foo
// test.kt:17 box
// test.kt:7 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:13 foo
// test.kt:18 box
// test.kt:8 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:19 box
+1
View File
@@ -24,3 +24,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:12 box
+4
View File
@@ -41,9 +41,13 @@ fun box() {
// 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
+1
View File
@@ -92,3 +92,4 @@ fun box() {
// test.kt:28 box
// test.kt:19 foo
// test.kt:22 foo
// test.kt:29 box
@@ -71,3 +71,4 @@ fun box() {
// test.kt:13 foo
// test.kt:19 foo
// test.kt:22 foo
// test.kt:29 box
@@ -26,3 +26,4 @@ fun box() {
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:5 box
// test.kt:16 box
+8
View File
@@ -80,13 +80,16 @@ fun box() {
// test.kt:10 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:12 foo
// test.kt:4 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:11 foo
// test.kt:4 foo
@@ -95,11 +98,16 @@ fun box() {
// test.kt:10 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:12 foo
// test.kt:4 foo
// test.kt:10 foo
// test.kt:13 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:10 foo
// test.kt:15 foo
// test.kt:19 box
+8
View File
@@ -130,13 +130,16 @@ fun box() {
// test.kt:13 foo
// test.kt:17 foo
// test.kt:12 foo
// test.kt:19 foo
// test.kt:13 foo
// test.kt:16 foo
// test.kt:5 foo
// test.kt:13 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:15 foo
// test.kt:5 foo
@@ -145,11 +148,16 @@ fun box() {
// test.kt:13 foo
// test.kt:17 foo
// test.kt:12 foo
// test.kt:19 foo
// test.kt:13 foo
// test.kt:16 foo
// test.kt:5 foo
// test.kt:13 foo
// test.kt:17 foo
// test.kt:12 foo
// test.kt:19 foo
// test.kt:12 foo
// test.kt:19 foo
// test.kt:12 foo
// test.kt:19 foo
// test.kt:23 box
@@ -81,6 +81,7 @@ fun nop() {}
// 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
@@ -94,3 +95,5 @@ fun nop() {}
// test.kt:25 box
// test.kt:14 box
// test.kt:14 box
// test.kt:28 nop
// test.kt:17 box
+1
View File
@@ -35,3 +35,4 @@ fun box() {
// test.kt:12 box
// test.kt:12 box
// test.kt:12 box
// test.kt:13 box
@@ -4,7 +4,6 @@
package org.jetbrains.kotlin.js.backend;
import com.intellij.openapi.util.text.StringUtil;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.js.backend.ast.*;
@@ -377,8 +376,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
@Override
public void visitCatch(@NotNull JsCatch x) {
pushSourceInfo(x.getSource());
printCommentsBeforeNode(x);
pushSourceInfo(x.getSource());
spaceOpt();
p.print(CHARS_CATCH);
@@ -399,8 +398,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
rightParen();
spaceOpt();
printCommentsAfterNode(x);
popSourceInfo();
printCommentsAfterNode(x);
sourceLocationConsumer.pushSourceInfo(null);
accept(x.getBody());
@@ -742,8 +741,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
@Override
public void visitIf(@NotNull JsIf x) {
pushSourceInfo(x.getSource());
printCommentsBeforeNode(x);
pushSourceInfo(x.getSource());
_if();
spaceOpt();
@@ -751,8 +750,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
accept(x.getIfExpression());
rightParen();
printCommentsAfterNode(x);
popSourceInfo();
printCommentsAfterNode(x);
JsStatement thenStmt = x.getThenStatement();
JsStatement elseStatement = x.getElseStatement();
@@ -1140,9 +1139,11 @@ public class JsToStringGenerationVisitor extends JsVisitor {
@Override
public void visitTry(@NotNull JsTry x) {
printCommentsBeforeNode(x);
pushSourceInfo(x.getSource());
p.print(CHARS_TRY);
spaceOpt();
lineBreakAfterBlock = false;
popSourceInfo();
accept(x.getTryBlock());
acceptList(x.getCatches());
@@ -1418,21 +1419,24 @@ public class JsToStringGenerationVisitor extends JsVisitor {
}
}
private void printJsBlock(JsBlock x, boolean finalNewline, Object closingBracketLocation) {
private void printJsBlock(JsBlock x, boolean finalNewline, @Nullable Object defaultClosingBraceLocation) {
if (!lineBreakAfterBlock) {
finalNewline = false;
lineBreakAfterBlock = true;
}
sourceLocationConsumer.pushSourceInfo(null);
printCommentsBeforeNode(x);
boolean needBraces = !x.isTransparent();
if (needBraces) {
sourceLocationConsumer.pushSourceInfo(x.getSource());
blockOpen();
sourceLocationConsumer.popSourceInfo();
}
sourceLocationConsumer.pushSourceInfo(null);
Iterator<JsStatement> iterator = x.getStatements().iterator();
while (iterator.hasNext()) {
boolean isGlobal = x.isTransparent() || globalBlocks.contains(x);
@@ -1454,7 +1458,6 @@ public class JsToStringGenerationVisitor extends JsVisitor {
accept(statement);
if (stmtIsGlobalBlock) {
//noinspection SuspiciousMethodCalls
globalBlocks.remove(statement);
}
if (needSemi) {
@@ -1494,23 +1497,28 @@ public class JsToStringGenerationVisitor extends JsVisitor {
// _blockClose() modified
p.indentOut();
if (closingBracketLocation != null) {
pushSourceInfo(closingBracketLocation);
sourceLocationConsumer.popSourceInfo();
Object closingBraceLocation = x.getClosingBraceSource();
if (closingBraceLocation == null)
closingBraceLocation = defaultClosingBraceLocation;
if (closingBraceLocation != null) {
pushSourceInfo(closingBraceLocation);
}
p.print('}');
if (closingBracketLocation != null) {
if (closingBraceLocation != null) {
popSourceInfo();
}
if (finalNewline) {
newlineOpt();
}
} else {
sourceLocationConsumer.popSourceInfo();
}
needSemi = false;
printCommentsAfterNode(x);
sourceLocationConsumer.popSourceInfo();
}
private void assignment() {
@@ -4,6 +4,7 @@
package org.jetbrains.kotlin.js.backend.ast;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.js.util.AstUtil;
import org.jetbrains.annotations.NotNull;
import com.intellij.util.SmartList;
@@ -17,6 +18,9 @@ public class JsBlock extends SourceInfoAwareJsNode implements JsStatement {
@NotNull
private final List<JsStatement> statements;
@Nullable
private Object closingBraceSource;
public JsBlock() {
this(new SmartList<JsStatement>());
}
@@ -38,6 +42,15 @@ public class JsBlock extends SourceInfoAwareJsNode implements JsStatement {
return statements;
}
@Nullable
public Object getClosingBraceSource() {
return closingBraceSource;
}
public void setClosingBraceSource(@Nullable Object closingBraceLocation) {
this.closingBraceSource = closingBraceLocation;
}
public boolean isEmpty() {
return statements.isEmpty();
}
@@ -67,6 +80,8 @@ public class JsBlock extends SourceInfoAwareJsNode implements JsStatement {
@NotNull
@Override
public JsBlock deepCopy() {
return new JsBlock(AstUtil.deepCopy(statements)).withMetadataFrom(this);
JsBlock block = new JsBlock(AstUtil.deepCopy(statements)).withMetadataFrom(this);
block.setClosingBraceSource(getClosingBraceSource());
return block;
}
}
@@ -21,6 +21,9 @@ public final class JsIf extends SourceInfoAwareJsNode implements JsStatement {
@Nullable
private JsStatement elseStatement;
@Nullable
private Object elseSource;
public JsIf(@NotNull JsExpression ifExpression, @NotNull JsStatement thenStatement, @Nullable JsStatement elseStatement) {
this.ifExpression = ifExpression;
this.thenStatement = thenStatement;
@@ -6,5 +6,5 @@ fun box(x: Int, y: Int) {
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_IR): 1 * 3 3 3 * 3 * 4 4 4 * 4 4 2 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): 1 1 * 3 3 3 * 3 3 * 4 4 4 * 4 4 2 7 7 7 7
+2 -2
View File
@@ -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_IR): 1 2 2 4 4 2 2 2 2 2 2 7 8 9 10 10 11 5 6 6 5 6
// LINES(JS): 1 2 2 4 4 2 2 2 2 5 5 5 6 7 12 8 9 10 11
// LINES(JS_IR): 1 1 2 2 4 4 2 2 2 2 2 2 7 8 9 10 10 11 5 6 6 5 6
+2 -2
View File
@@ -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_IR): 1 3 3 * 6 6 * 9 9 * 13 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): 1 1 3 3 5 * 6 6 * 8 9 9 * 13 13 15 15 17 18 18
+2 -2
View File
@@ -14,5 +14,5 @@ class C {
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_IR): 1 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): 1 1 2 4 3 2 6 8 7 6 11 11 12 12 12 14 14 14
@@ -15,4 +15,4 @@ fun A.foo() {
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_IR): 1 3 4 4 11 11 12 12 15 15 15 5 * 6 7 7 8 8
// LINES(JS_IR): 1 1 3 3 4 4 11 11 12 12 15 15 15 15 5 5 * 6 7 7 8 8
+2 -2
View File
@@ -5,5 +5,5 @@ fun box(x: Int, y: Int): Int {
return foo(y)
}
// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5
// LINES(JS_IR): 1 5 5 2 4 4
// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5
// LINES(JS_IR): 1 1 5 5 2 4 4 4
@@ -11,5 +11,5 @@ 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 * 1 3 3 4 5 1 * 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 * 1 1 3 3 4 5 1 * 8 8 10 10 10 10 12 12 12 12
@@ -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 * 4 6 * 13 13 14 14 8 2 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 * 8 * 13 13 14 14 8 2 12 12 13 13 14 14
+1 -1
View File
@@ -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 * 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
// LINES(JS_IR): 4 4 * 19 * 19 19 * 5 * 45 * 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 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_IR): 1 1 1 1 1 1 1 1 1 8 * 1 1 1 1 * 2 * 3 3 3 * 5 5
// LINES(JS_IR): 1 1 1 1 1 1 1 1 1 1 8 8 * 1 1 1 1 1 * 2 * 3 3 3 * 5 5
+1 -1
View File
@@ -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
// FIXME: componentN function body should point to the corresponding property.
// 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
// LINES(JS_IR): 1 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 1 1 1
+1 -1
View File
@@ -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_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
// LINES(JS_IR): 3 3 3 3 1 1 3 3 3 2 3 3 3 2 1 2 6 6 7 7 10 10 10 10 10 10 10 11 12 12 2 2
+2 -2
View File
@@ -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_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
// LINES(JS): 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14
// LINES(JS_IR): 3 3 5 5 4 5 5 5 4 1 4 5 4 5 5 5 4 1 4 8 8 9 10 10 13 14 14 4 4 * 4 4
+1 -1
View File
@@ -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_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
// LINES(JS_IR): 11 11 11 11 * 1 1 3 3 1 1 1 1 1 1 1 1 1 5 11 11 12 12 12 16 17 17 15 15 15 11 11
+1 -1
View File
@@ -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_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
// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 9 4 9 9 6 6 9 7 7 9 11 11 12 12 15 15 25 25 26 26 15 15 17 17 16 18 18 16 20 20 21 21 22 22 * 1
@@ -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 * 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
// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 9 4 9 9 * 6 * 31 31 9 6 6 * 7 * 33 33 9 7 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 15 * 17 * 31 31 16 17 17 * 18 * 33 33 16 18 18 20 20 21 21 22 22 * 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_IR): 1 2 2 4 4 * 8 8 8 8 8 11 11 * 7 12
// 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): 1 1 2 2 3 3 4 4 * 8 8 8 8 8 11 11 * 7 12
+1 -1
View File
@@ -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 * 3 4 5 5 * 5 * 7 7 7 * 5 4 4 10 10 10 * 1
// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 5 5 * 5 5 * 7 7 7 * 5 4 4 10 10 10 10 * 1
@@ -6,5 +6,5 @@ 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_IR): 4 * 5 5 5 5 5 * 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): 4 4 * 5 5 5 5 5 * 1 * 1 * 1 1
+1 -1
View File
@@ -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_IR): 4 * 5 5 5 * 8 * 9 9 9 * 1 * 1 * 1
// LINES(JS_IR): 4 4 * 5 5 5 * 8 8 * 9 9 9 * 1 * 1 * 1 1
@@ -4,5 +4,5 @@ fun box() =
fun foo() =
23
// LINES(JS): 1 2 2 4 5 5
// LINES(JS_IR): 1 2 2 4 5 5
// LINES(JS): 1 2 2 4 5 5
// LINES(JS_IR): 1 2 2 2 4 5 5 5

Some files were not shown because too many files have changed in this diff Show More