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
| interface Component { | |
| val children: Iterable<Component> | |
| fun requestFocus() | |
| fun clearFocus() | |
| } | |
| class MyComponent( | |
| override val children: Iterable<Component>, | |
| val drawSurface: DrawSurface) : Component { |
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
| class MyComponent( | |
| val children: Iterable<Component>, // 1 | |
| internal val drawSurface: DrawSurface) { // 2 | |
| fun requestFocus() { | |
| } | |
| fun clearFocus() { | |
| } |
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
| class MyComponent( | |
| val children: List<MyComponent>, // 1 | |
| internal val drawSurface: PixelGraphicsImpl) { // 2 | |
| fun requestFocus() { | |
| } | |
| fun clearFocus() { | |
| } |
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
| class MyComponent( | |
| val isFocused: Boolean, | |
| val children: List<MyComponent>, | |
| val drawSurface: PixelGraphicsImpl) { | |
| fun requestFocus() { | |
| } | |
| fun clearFocus() { | |
| } |
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
| class Tile | |
| fun writeTile(tile: Tile) = | |
| println("Tile: $tile") | |
| writeTile(Tile()) |
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
| class Tile: | |
| pass | |
| def write_tile(tile: Tile): | |
| print("Tile: " + str(tile)) | |
| write_tile(Tile()) |
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
| public final class SomeClass { | |
| // $FF: synthetic field | |
| static final KProperty[] $$delegatedProperties = new KProperty[]{(KProperty)Reflection.mutableProperty1(new MutablePropertyReference1Impl(Reflection.getOrCreateKotlinClass(SomeClass.class), "someValue", "getSomeValue()Ljava/lang/String;"))}; | |
| @NotNull | |
| private final ReadWriteProperty someValue$delegate = NotNullVarKt.notNull(); | |
| @NotNull | |
| public final String getSomeValue() { | |
| return (String)this.someValue$delegate.getValue(this, $$delegatedProperties[0]); | |
| } |
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
| class SomeClass { | |
| var someValue: String by notNull() | |
| } |
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
| public fun <T : Any> notNull(): ReadWriteProperty<Any?, T> = NotNullVar() |
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
| class NotNullVar<T : Any> : ReadWriteProperty<Any?, T> { | |
| private var value: T? = null | |
| public override fun getValue(thisRef: Any?, property: KProperty<*>): T { | |
| return value ?: throw IllegalStateException("Property ${property.name} should be initialized before get.") | |
| } | |
| public override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { | |
| this.value = value | |
| } |