Fix generation of JS source maps for closures
This commit is contained in:
@@ -36,6 +36,12 @@ public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/lineNumbers"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("closure.kt")
|
||||
public void testClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/closure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlining.kt")
|
||||
public void testInlining() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/inlining.kt");
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ class LiteralFunctionTranslator(context: TranslationContext) : AbstractTranslato
|
||||
val tracker = functionContext.usageTracker()!!
|
||||
|
||||
if (tracker.hasCapturedExceptContaining()) {
|
||||
val lambdaCreator = simpleReturnFunction(invokingContext.scope(), lambda)
|
||||
val lambdaCreator = simpleReturnFunction(invokingContext.scope(), lambda.source(declaration))
|
||||
lambdaCreator.name = invokingContext.getInnerNameForDescriptor(descriptor)
|
||||
lambdaCreator.isLocal = true
|
||||
if (descriptor in tracker.capturedDescriptors && !descriptor.isCoroutineLambda) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fun box(x: Int, y: Int): Int {
|
||||
fun foo(
|
||||
z: Int) =
|
||||
x + z
|
||||
return foo(y)
|
||||
}
|
||||
|
||||
// LINES: 2 4 2 5
|
||||
Reference in New Issue
Block a user