Copy location info when copying JS AST subtrees

This is necessary to preserve source information of a function's body
after inlining.
This commit is contained in:
Alexey Andreev
2017-05-02 19:13:56 +03:00
parent 9218b61141
commit e5662ac2ad
4 changed files with 50 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
fun box() {
println("1")
bar()
println("2")
bar()
println("3")
}
inline fun bar() {
println("bar1")
println("bar2")
}
// LINES: 2 10 11 4 10 11 6 10 11
@@ -0,0 +1,19 @@
fun box() {
println("1")
foo {
println("x")
}
println("2")
foo {
println("y")
}
println("3")
}
inline fun foo(f: () -> Unit) {
println("before")
f()
println("after")
}
// LINES: 2 14 4 16 6 14 8 16 10 14 15 16