@@ -97,26 +97,11 @@ import Decorators._
97
97
98
98
if (sym.is(Accessor , butNot = NoFieldNeeded ))
99
99
if (sym.isGetter) {
100
- def skipBlocks (t : Tree ): Tree = t match {
101
- case Block (_, t1) => skipBlocks(t1)
102
- case _ => t
103
- }
104
- skipBlocks(tree.rhs) match {
105
- case lit : Literal if sym.is(Final , butNot = Mutable ) && isIdempotentExpr(tree.rhs) =>
106
- // duplicating scalac behavior: for final vals that have rhs as constant, we do not create a field
107
- // and instead return the value. This seemingly minor optimization has huge effect on initialization
108
- // order and the values that can be observed during superconstructor call
109
-
110
- // see remark about idempotency in PostTyper#normalizeTree
111
- cpy.DefDef (tree)(rhs = lit)
112
- case _ =>
113
- var rhs = tree.rhs.changeOwnerAfter(sym, field, thisTransform)
114
- if (isWildcardArg(rhs)) rhs = EmptyTree
115
-
116
- val fieldDef = transformFollowing(ValDef (field, adaptToField(rhs)))
117
- val getterDef = cpy.DefDef (tree)(rhs = transformFollowingDeep(ref(field))(ctx.withOwner(sym), info))
118
- Thicket (fieldDef, getterDef)
119
- }
100
+ var rhs = tree.rhs.changeOwnerAfter(sym, field, thisTransform)
101
+ if (isWildcardArg(rhs)) rhs = EmptyTree
102
+ val fieldDef = transformFollowing(ValDef (field, adaptToField(rhs)))
103
+ val getterDef = cpy.DefDef (tree)(rhs = transformFollowingDeep(ref(field))(ctx.withOwner(sym), info))
104
+ Thicket (fieldDef, getterDef)
120
105
} else if (sym.isSetter) {
121
106
if (! sym.is(ParamAccessor )) { val Literal (Constant (())) = tree.rhs } // this is intended as an assertion
122
107
field.setFlag(Mutable ) // necessary for vals mixed in from Scala2 traits
@@ -127,5 +112,5 @@ import Decorators._
127
112
// neither getters nor setters
128
113
else tree
129
114
}
130
- private val NoFieldNeeded = Lazy | Deferred | JavaDefined
115
+ private val NoFieldNeeded = Lazy | Deferred | JavaDefined | Inline
131
116
}
0 commit comments