JS backend: tests for reflection support

This commit is contained in:
Michael Nedzelsky
2014-07-22 15:21:35 +04:00
parent cc98664832
commit 145aa5a276
70 changed files with 1464 additions and 0 deletions
@@ -0,0 +1,32 @@
package foo
fun run(a: A, arg: String, funRef:A.(String) -> String): String {
return a.(funRef)(arg)
}
class A {
val s = "sA"
fun memBar(other: String): String = s +":memBar:" + other
}
fun A.extBar(other: String):String = s + ":extBar:" + other
fun box():String {
fun A.locExtBar(other: String):String = s + ":locExtBar:" + other
val a = A()
var r = run(a, "!!", A::memBar)
if (r != "sA:memBar:!!") return r
r = run(a, "!!", A::extBar)
if (r != "sA:extBar:!!") return r
r = run(a, "!!", A::locExtBar)
if (r != "sA:locExtBar:!!") return r
r = run(a, "!!") {A.(other:String):String -> s + ":literal:" + other }
if (r != "sA:literal:!!") return r
return "OK"
}