diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-05 13:22:00 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:14:15 +0100 |
commit | 321563940dee1716c19600efd57acb9ed83a7687 (patch) | |
tree | 9053dfcff007d16ceb6dbaa7256889455a7a07a7 /src/dotty/tools/dotc/ast/TreeInfo.scala | |
parent | 7fd242f2f1b1d2f536e73ec0fdb92a34b27b2a89 (diff) | |
download | dotty-321563940dee1716c19600efd57acb9ed83a7687.tar.gz dotty-321563940dee1716c19600efd57acb9ed83a7687.tar.bz2 dotty-321563940dee1716c19600efd57acb9ed83a7687.zip |
Compute PureInterface flag after pickling.
ElimLocals becomes a slightly less trivial transform: NormalizeFlags.
It also computes PureInterface flag, thus relieving Namer and Unpickler
from doing the same in two different ways. Besides, the computation in
Namer/TreeInfo was flawed because it did not take into account that
nested non-static classes are not allowed in an interface (only static
classes are, but these would not be members of the interface in the Scala
sense).
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeInfo.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 5338297e8..0abd25f51 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -24,19 +24,14 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] => case _ => false } - /** Is tree legal as a member definition of an interface? + /** Does tree contain an initialization part when seen as a member of a class or trait? */ - def isPureInterfaceMember(tree: Tree): Boolean = unsplice(tree) match { + def isNoInitMember(tree: Tree): Boolean = unsplice(tree) match { case EmptyTree | Import(_, _) | TypeDef(_, _) => true - case defn: ValOrDefDef => defn.unforcedRhs == EmptyTree + case tree: ValDef => tree.unforcedRhs == EmptyTree case _ => false } - /** Is tree legal as a member definition of a no-init trait? - */ - def isNoInitMember(tree: Tree): Boolean = - isPureInterfaceMember(tree) || unsplice(tree).isInstanceOf[DefDef] - def isOpAssign(tree: Tree) = unsplice(tree) match { case Apply(fn, _ :: Nil) => unsplice(fn) match { |