aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/ast
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-08 21:19:16 +1100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:28:44 +0200
commit41d83d42650d0c0b54c47c1a9043d0b92315aa4e (patch)
tree1bf4ca65464cf3f74b10ec14f718d4b4599223d7 /compiler/src/dotty/tools/dotc/ast
parent69fd9dc80e78feb35ee601a9aaac813eef331e6a (diff)
downloaddotty-41d83d42650d0c0b54c47c1a9043d0b92315aa4e.tar.gz
dotty-41d83d42650d0c0b54c47c1a9043d0b92315aa4e.tar.bz2
dotty-41d83d42650d0c0b54c47c1a9043d0b92315aa4e.zip
Change handling of enum defs.
The previous scheme did not work because desugaring cannot deal with repeated expansions. We now sidestep the issue by doing the expansion in the parser. Luckily, positions work out perfectly, so that one can reconstruct the source precisely from the parsed untyped trees.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast')
-rw-r--r--compiler/src/dotty/tools/dotc/ast/untpd.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/untpd.scala b/compiler/src/dotty/tools/dotc/ast/untpd.scala
index e14c6714b..7020e4dac 100644
--- a/compiler/src/dotty/tools/dotc/ast/untpd.scala
+++ b/compiler/src/dotty/tools/dotc/ast/untpd.scala
@@ -9,6 +9,7 @@ import Decorators._
import util.Property
import language.higherKinds
import collection.mutable.ListBuffer
+import reflect.ClassTag
object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
@@ -39,9 +40,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def withName(name: Name)(implicit ctx: Context) = cpy.ModuleDef(this)(name.toTermName, impl)
}
- /** mods case name impl */
- case class EnumDef(name: TypeName, impl: Template) extends MemberDef
-
case class ParsedTry(expr: Tree, handler: Tree, finalizer: Tree) extends TermTree
case class SymbolLit(str: String) extends TermTree
@@ -192,6 +190,10 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def hasFlags = flags != EmptyFlags
def hasAnnotations = annotations.nonEmpty
def hasPrivateWithin = privateWithin != tpnme.EMPTY
+ def hasMod[T: ClassTag] = {
+ val cls = implicitly[ClassTag[T]].runtimeClass
+ mods.exists(mod => cls.isAssignableFrom(mod.getClass))
+ }
}
@sharable val EmptyModifiers: Modifiers = new Modifiers()