Fix JS source maps for functions with expression body

This commit is contained in:
Alexey Andreev
2017-05-15 13:24:02 +03:00
parent 1014666937
commit ed592452a3
5 changed files with 17 additions and 3 deletions
@@ -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");
@@ -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
View File
@@ -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
View File
@@ -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