diff options
author | Martin Odersky <odersky@gmail.com> | 2015-02-14 18:39:14 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:14:08 +0100 |
commit | 5b63106448275d6cc4bb6822af33247c2521a63c (patch) | |
tree | 4313312569f2ae3f15f8cb1c763bc30c19c1eeea /src/dotty/tools/dotc/transform/SuperAccessors.scala | |
parent | 9262d475e648219eb9ef4410d91621cc5f1f17cc (diff) | |
download | dotty-5b63106448275d6cc4bb6822af33247c2521a63c.tar.gz dotty-5b63106448275d6cc4bb6822af33247c2521a63c.tar.bz2 dotty-5b63106448275d6cc4bb6822af33247c2521a63c.zip |
Make some tree fields lazy
Lazy fields are
- the rhs field of a ValDef or DefDef
- the body field of a Template
These can be instantiated with Lazy instances.
The scheme is such that lazy fields are completely
transparent for users of the Trees API.
The only downside is that the parameter used to initialize
a potentially lazy field has a weak type (now it's Any, with
Dotty it would be a union type of the form `T | Lazy[T]`.
Therefore, the parameter cannot be recovered through pattern
matching.
Diffstat (limited to 'src/dotty/tools/dotc/transform/SuperAccessors.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/SuperAccessors.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/SuperAccessors.scala b/src/dotty/tools/dotc/transform/SuperAccessors.scala index 0d89e9d74..c4ff6e549 100644 --- a/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -369,9 +369,9 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this } transformSelect - case tree @ DefDef(_, _, _, _, rhs) => + case tree: DefDef => cpy.DefDef(tree)( - rhs = if (isMethodWithExtension(sym)) withInvalidOwner(transform(rhs)) else transform(rhs)) + rhs = if (isMethodWithExtension(sym)) withInvalidOwner(transform(tree.rhs)) else transform(tree.rhs)) case TypeApply(sel @ Select(qual, name), args) => mayNeedProtectedAccessor(sel, args, goToSuper = true) |