Fix JS source maps for functions with expression body
This commit is contained in:
@@ -102,6 +102,12 @@ public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("expressionAsFunctionBody.kt")
|
||||
public void testExpressionAsFunctionBody() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/expressionAsFunctionBody.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/for.kt");
|
||||
|
||||
+2
-1
@@ -149,7 +149,8 @@ public final class FunctionBodyTranslator extends AbstractTranslator {
|
||||
node = JsAstUtils.charToBoxedChar((JsExpression) node);
|
||||
}
|
||||
|
||||
JsReturn jsReturn = new JsReturn((JsExpression)node);
|
||||
JsReturn jsReturn = new JsReturn((JsExpression) node);
|
||||
jsReturn.setSource(declaration);
|
||||
MetadataProperties.setReturnTarget(jsReturn, descriptor);
|
||||
return jsReturn;
|
||||
});
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ fun box(x: Int, y: Int): Int {
|
||||
return foo(y)
|
||||
}
|
||||
|
||||
// LINES: 2 4 2 5
|
||||
// LINES: 2 2 4 2 5
|
||||
+1
-1
@@ -14,4 +14,4 @@ suspend fun bar(): Unit {
|
||||
println(a + b)
|
||||
}
|
||||
|
||||
// LINES: 4 5 6 4 9 9 9 9 9 9 9 9 * 10 11 11 11 11 11 * 11 12 13 13 13 13 13 13 14
|
||||
// LINES: 4 5 4 6 4 9 9 9 9 9 9 9 9 * 10 11 11 11 11 11 * 11 12 13 13 13 13 13 13 14
|
||||
@@ -0,0 +1,7 @@
|
||||
fun box() =
|
||||
foo()
|
||||
|
||||
fun foo() =
|
||||
23
|
||||
|
||||
// LINES: 1 2 4 5
|
||||
Reference in New Issue
Block a user