diff options
author | Martin Odersky <odersky@gmail.com> | 2013-06-15 22:01:42 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-06-15 22:01:42 +0200 |
commit | c190626eb0a7c6a314429bb4f3c498da989395fc (patch) | |
tree | b33b87a0d2cdc5b8d75be698143e1a7e759460db /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 658fc7f7070e8f13abd0391ff4e6045ac34e2891 (diff) | |
download | dotty-c190626eb0a7c6a314429bb4f3c498da989395fc.tar.gz dotty-c190626eb0a7c6a314429bb4f3c498da989395fc.tar.bz2 dotty-c190626eb0a7c6a314429bb4f3c498da989395fc.zip |
Removed ClassDef as a Tree node class.
ClassDefs are now TypeDefs that have a Template as rhs.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 1b3c2f22b..0d78e070d 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -48,8 +48,8 @@ class Typer extends Namer { tdef.withType(sym.symRef).derivedTypeDef(mods1, name, rhs1) } - def typedClassDef(cdef: untpd.ClassDef, cls: ClassSymbol)(implicit ctx: Context) = { - val Trees.ClassDef(mods, name, impl @ Template(constr, parents, self, body)) = cdef + def typedClassDef(cdef: untpd.TypeDef, cls: ClassSymbol)(implicit ctx: Context) = { + val Trees.TypeDef(mods, name, impl @ Template(constr, parents, self, body)) = cdef val mods1 = typedModifiers(mods) val constr1 = typed(constr).asInstanceOf[DefDef] val parents1 = parents mapconserve (typed(_)) @@ -61,7 +61,7 @@ class Typer extends Namer { val impl1 = impl.withType(localDummy.symRef).derivedTemplate( constr1, parents1, self1, body1) - cdef.withType(cls.symRef).derivedClassDef(mods1, name, impl1) + cdef.withType(cls.symRef).derivedTypeDef(mods1, name, impl1) // todo later: check that // 1. If class is non-abstract, it is instantiatable: @@ -90,9 +90,8 @@ class Typer extends Namer { val typer1 = nestedTyper.remove(sym).get typer1.typedDefDef(tree, sym)(localContext.withTyper(typer1)) case tree: untpd.TypeDef => - typedTypeDef(tree, sym)(localContext.withNewScope) - case tree: untpd.ClassDef => - typedClassDef(tree, sym.asClass)(localContext) + if (tree.isClassDef) typedClassDef(tree, sym.asClass)(localContext) + else typedTypeDef(tree, sym)(localContext.withNewScope) case tree: untpd.Import => typedImport(tree, sym) case tree: untpd.TypeTree => |