Fix generation of JS source maps for long literals

This commit is contained in:
Alexey Andreev
2017-05-10 18:04:38 +03:00
parent 89e3fb7592
commit 6e489900cb
3 changed files with 17 additions and 3 deletions
@@ -90,6 +90,12 @@ public class JsLineNumberTestGenerated extends AbstractJsLineNumberTest {
doTest(fileName);
}
@TestMetadata("longLiteral.kt")
public void testLongLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/longLiteral.kt");
doTest(fileName);
}
@TestMetadata("multipleReferences.kt")
public void testMultipleReferences() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/lineNumbers/multipleReferences.kt");
@@ -101,7 +101,7 @@ public final class Translation {
if (type != null) {
if (KotlinBuiltIns.isLong(type) || (KotlinBuiltIns.isInt(type) && expression instanceof KtUnaryExpression)) {
JsExpression constantResult = translateConstant(compileTimeValue, expression, context);
if (constantResult != null) return constantResult;
if (constantResult != null) return constantResult.source(expression);
}
}
}
@@ -186,7 +186,7 @@ public final class Translation {
@NotNull JsBlock block
) {
JsNode jsNode = translateExpression(expression, context, block);
if (jsNode instanceof JsExpression) {
if (jsNode instanceof JsExpression) {
KotlinType expressionType = context.bindingContext().getType(expression);
return unboxIfNeeded((JsExpression) jsNode, expressionType != null && KotlinBuiltIns.isCharOrNullableChar(expressionType));
}
@@ -200,7 +200,7 @@ public final class Translation {
}
block.getStatements().add(convertToStatement(jsNode));
return new JsNullLiteral();
return new JsNullLiteral().source(expression);
}
@NotNull
+8
View File
@@ -0,0 +1,8 @@
fun foo() {
println(
23L)
println(
0L)
}
// LINES: 2 3 4 5