aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.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/typer/Namer.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/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index c522a5998..4bf194f5e 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -436,9 +436,9 @@ class Namer { typer: Typer =>
protected implicit val ctx: Context = localContext(cls).setMode(ictx.mode &~ Mode.InSuperCall)
- val TypeDef(name, impl @ Template(constr, parents, self, body)) = original
+ val TypeDef(name, impl @ Template(constr, parents, self, _)) = original
- val (params, rest) = body span {
+ val (params, rest) = impl.body span {
case td: TypeDef => td.mods is Param
case td: ValDef => td.mods is ParamAccessor
case _ => false
@@ -496,9 +496,9 @@ class Namer { typer: Typer =>
index(rest)(inClassContext(selfInfo))
denot.info = ClassInfo(cls.owner.thisType, cls, parentRefs, decls, selfInfo)
if (cls is Trait) {
- if (body forall isNoInitMember) {
+ if (impl.body forall isNoInitMember) {
cls.setFlag(NoInits)
- if (body forall isPureInterfaceMember)
+ if (impl.body forall isPureInterfaceMember)
cls.setFlag(PureInterface)
}
}