Created
November 26, 2013 14:00
-
-
Save abreslav/7658690 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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