JS backend: use special JsScope(JsDynamicScope) for names from dynamic calls instead of use containing scope to avoid the impact on local names.

This commit is contained in:
Zalim Bashorov
2014-12-10 22:46:42 +03:00
parent af82e69214
commit 6b50d74056
4 changed files with 37 additions and 3 deletions
@@ -0,0 +1,26 @@
package foo
fun assertContains(expectedName: String, f: () -> Unit) {
val s = f.toString()
assertTrue(s.contains(expectedName), "\"$s\" dosn't contain \"$expectedName\"")
}
fun box(): String {
val d: dynamic = bar
val a = {
val somethingBefore = 1
d.somethingBefore
}
assertContains("var somethingBefore = 1;", a)
val b = {
d.somethingAfter
val somethingAfter = 1
}
assertContains("var somethingAfter = 1;", b)
return "OK"
}