JS: refactor flat declaration generator. Add more tests on inter-module dependencies

This commit is contained in:
Alexey Andreev
2016-10-26 17:14:54 +03:00
parent cc38bd3146
commit 0252fe57af
26 changed files with 483 additions and 81 deletions
@@ -0,0 +1,42 @@
// MODULE: lib
// FILE: lib.kt
package lib
class A(val x: Int)
fun A.foo() = 23 + x
inline fun A.baz() = 99 + x
inline fun A.callFoo() = foo()
inline fun A.buzz(): Int {
val o = object {
fun f() = 111 + x
}
return o.f()
}
// MODULE: main(lib)
// FILE: main.kt
package main
import lib.*
fun box(): String {
val a = A(1).foo()
if (a != 24) return "fail: simple function: $a"
val c = A(1).baz()
if (c != 100) return "fail: inline function: $c"
val d = A(1).buzz()
if (d != 112) return "fail: inline function with object expression: $d"
val e = A(2).callFoo()
if (e != 25) return "fail: inline function calling another function: $e"
return "OK"
}