diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-17 22:00:57 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-17 22:00:57 +0000 |
commit | 23ab7e3c9a46ef6c509a452f8ee3d2f224235bde (patch) | |
tree | 3aab2bd751a9825afc567ccb1055cd215de71cce /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | |
parent | a98d0903a8a02f806726a45b65842a0da21115b7 (diff) | |
download | scala-23ab7e3c9a46ef6c509a452f8ee3d2f224235bde.tar.gz scala-23ab7e3c9a46ef6c509a452f8ee3d2f224235bde.tar.bz2 scala-23ab7e3c9a46ef6c509a452f8ee3d2f224235bde.zip |
Overhaul of Namers.
I can't go bear hunting without a clean gun. Basically I iterated over
Namers until I could understand it. I added a variety of documentation
there and elsewhere. There shouldn't be anything particularly behavioral
changing in this commit, but I did delete some years-old code (having
huge commented out blocks of way-out-of-date code is not a boon to
understanding) and the debugging output will look different. Better, one
can hope.
How about, review by moors.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 104f53eb4d..394192e22f 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2682,17 +2682,19 @@ self => * }}} */ def templateOpt(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]], tstart: Int): Template = { - /** A synthetic ProductN parent for case classes. */ - def extraCaseParents = ( + /** Extra parents for case classes. */ + def caseParents() = ( if (mods.isCase) { val arity = if (vparamss.isEmpty || vparamss.head.isEmpty) 0 else vparamss.head.size - if (arity == 0) Nil - else List( - AppliedTypeTree( - productConstrN(arity), - vparamss.head map (vd => vd.tpt.duplicate setPos vd.tpt.pos.focus) + productConstr :: serializableConstr :: { + if (arity == 0) Nil + else List( + AppliedTypeTree( + productConstrN(arity), + vparamss.head map (vd => vd.tpt.duplicate setPos vd.tpt.pos.focus) + ) ) - ) + } } else Nil ) @@ -2719,10 +2721,7 @@ self => if (!isInterface(mods, body) && !isScalaArray(name)) parents0 :+ scalaScalaObjectConstr else if (parents0.isEmpty) List(scalaAnyRefConstr) else parents0 - ) ++ ( - if (mods.isCase) List(productConstr, serializableConstr) ++ extraCaseParents - else Nil - ) + ) ++ caseParents() Template(parents, self, constrMods, vparamss, argss, body, o2p(tstart)) } } |