Fix JS source maps for lambdas with captured variables

This commit is contained in:
Alexey Andreev
2017-06-23 13:43:48 +03:00
parent ec2a5bf0ee
commit d8fe7e55db
5 changed files with 7 additions and 5 deletions
@@ -85,7 +85,9 @@ public final class TranslationUtils {
@NotNull
public static JsFunction simpleReturnFunction(@NotNull JsScope functionScope, @NotNull JsExpression returnExpression) {
return new JsFunction(functionScope, new JsBlock(new JsReturn(returnExpression)), "<simpleReturnFunction>");
JsReturn jsReturn = new JsReturn(returnExpression);
jsReturn.setSource(returnExpression.getSource());
return new JsFunction(functionScope, new JsBlock(jsReturn), "<simpleReturnFunction>");
}
@NotNull
+1 -1
View File
@@ -5,4 +5,4 @@ fun box(x: Int, y: Int): Int {
return foo(y)
}
// LINES: 2 2 4 4 6 2 2 5 5
// LINES: 2 2 2 4 4 6 2 2 5 5
+1 -1
View File
@@ -14,4 +14,4 @@ suspend fun bar(): Unit {
println(a + b)
}
// LINES: 4 4 5 5 5 5 6 4 4 4 15 9 9 9 9 15 9 9 9 9 * 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 14 14
// LINES: 4 4 4 5 5 5 5 6 4 4 4 15 9 9 9 9 15 9 9 9 9 * 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 14 14
+1 -1
View File
@@ -18,4 +18,4 @@ val o = object : I {
}
}
// LINES: 1 2 3 2 2 2 2 2 * 11 12 12 12 15 15 15 18 17 17
// LINES: 1 2 3 2 2 2 2 2 2 2 * 11 12 12 12 15 15 15 18 17 17
+1 -1
View File
@@ -4,4 +4,4 @@ fun foo(x: Int): () -> Unit = {
fun bar() = 23
// LINES: 1 1 2 2 1 1 1 5 5 5
// LINES: 1 1 1 2 2 1 1 1 5 5 5