backend: Use simple DFS during closure building.

Now closure builder can contain includes. Includes
are another builders which closures must be added
to the building one.
Includes are:

For function closure:
	call targets (including constructors)
	callable reference targets

For class:
	all children declarations
	call targets (including constructors)
        callable reference targets

For constructor:
	call and callable reference targets
	delegating constructor call target
	constructing class closure
This commit is contained in:
Ilya Matveev
2017-02-10 17:37:03 +03:00
committed by ilmat192
parent 95a9f65afd
commit c68c4d3b6d
6 changed files with 127 additions and 75 deletions
@@ -7,5 +7,17 @@ fun main(args : Array<String>) {
}
local0()
}
fun l1() {
var x = 1
fun l2() {
fun l3() {
l1()
x = 5
}
l3()
}
}
println("OK")
}
@@ -0,0 +1,16 @@
fun main(args: Array<String>) {
var a = 0
fun local() {
class A {
val b = 0
fun f() {
a = b
}
}
fun local2() : A {
return A()
}
}
println("OK")
}
@@ -0,0 +1,21 @@
fun main(args : Array<String>) {
var x = 0
class A {
fun bar() {
fun local() {
class B {
fun baz() {
fun local2() {
x++
}
local2()
}
}
B().baz()
}
local()
}
}
A().bar()
println("OK")
}