aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/MacroTransform.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-02-14 18:39:14 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:14:08 +0100
commit5b63106448275d6cc4bb6822af33247c2521a63c (patch)
tree4313312569f2ae3f15f8cb1c763bc30c19c1eeea /src/dotty/tools/dotc/transform/MacroTransform.scala
parent9262d475e648219eb9ef4410d91621cc5f1f17cc (diff)
downloaddotty-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/MacroTransform.scala')
-rw-r--r--src/dotty/tools/dotc/transform/MacroTransform.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/MacroTransform.scala b/src/dotty/tools/dotc/transform/MacroTransform.scala
index 3a8bcc920..0f57c3ff5 100644
--- a/src/dotty/tools/dotc/transform/MacroTransform.scala
+++ b/src/dotty/tools/dotc/transform/MacroTransform.scala
@@ -58,12 +58,12 @@ abstract class MacroTransform extends Phase {
tree
case _: PackageDef | _: MemberDef =>
super.transform(tree)(localCtx(tree))
- case Template(constr, parents, self, body) =>
+ case impl @ Template(constr, parents, self, _) =>
cpy.Template(tree)(
transformSub(constr),
transform(parents)(ctx.superCallContext),
transformSelf(self),
- transformStats(body, tree.symbol))
+ transformStats(impl.body, tree.symbol))
case _ =>
super.transform(tree)
}