Commit Graph

6 Commits

Author SHA1 Message Date
pyos d988853c11 JVM_IR: optimize out redundant delegated property receiver fields
Now this:

    class C {
        val x = something
        val y by x::property
    }

is *exactly* the same as this:

    class C {
        val x = something
        val y get() = x.property
    }

(plus a `getY$delegate` method)
2021-07-12 22:38:45 +02:00
pyos 5d0102a966 JVM_IR: generate $delegate methods for val x by ::y 2021-07-12 22:38:44 +02:00
pyos e49410e07b JVM_IR: optimize delegation by property references
E.g. a statement like

    var x by ::y

is semantically equivalent to

    var x
      get() = y
      set(value) { y = value }

and thus does not need a full property reference object, or even a field
if the receiver is not bound.

 #KT-39054 Fixed
 #KT-47102 Fixed
2021-07-12 22:38:43 +02:00
Steven Schäfer b15e32936e JVM IR: Optimize delegated properties (KT-36814) 2020-07-31 19:00:27 +03:00
Dmitry Petrov 0b9b1b6945 Update bytecode text tests for JVM_IR 2020-02-18 22:51:29 +03:00
Dmitry Petrov a633a33627 KT-14513 Don't generate delegated property metadata when unused
If the delegated property operators involved are inline, and delegated
property metadata parameter is not used (which is often the case, e.g.,
'lazy'), we can skip those properties in metadata generation.

NOT implemented: special case when only 'kProperty.name' is used by the
corresponding delegated property operators.

Also a sneak fix for KT-34060.
2019-10-02 17:14:48 +04:00