Skip to content

Instantly share code, notes, and snippets.

@abreslav
Created November 26, 2013 14:00
Show Gist options
  • Select an option

  • Save abreslav/7658690 to your computer and use it in GitHub Desktop.

Select an option

Save abreslav/7658690 to your computer and use it in GitHub Desktop.
package ru.ifmo.rain.adsl;
import java.io.FileOutputStream
fun main(args: Array<String>) {
val generator = Generator(FileOutputStream("out.kt"), args[0], args[1])
generator.run()
}
class View
open class Layout
class Layout1: Layout()
fun layout(f: Layout.() -> Unit) {}
fun layout1(f: Layout1.() -> Unit) {}
fun layout1b(f: Layout1Builder.() -> Unit) {}
fun Layout1.layoutParams(f: Layout1.() -> Unit) {
}
class Layout1Builder {
fun View.layoutParams(f: Layout1.() -> Unit) {
println(this: View)
}
}
var Layout1.foo: Int
get() = 1
set(v) {}
fun view(f: View.() -> Unit) {}
fun test() {
layout {
view {
layoutParams {
foo = 1
}
}
}
layout1 {
view {
// can't access view
layoutParams {
foo = 1
}
}
}
layout1b {
view {
layoutParams {
// can access view
foo = 1
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment