diff options
author | Martin Odersky <odersky@gmail.com> | 2009-02-23 19:21:05 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-02-23 19:21:05 +0000 |
commit | bf35b888e49afb245883571cc00cbb5ec7341f24 (patch) | |
tree | 8c060484dde8c122f1d65fceedf0dd962a4ad90c /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | |
parent | a4baf48a5fb38f29d462accc57f93032955efa0e (diff) | |
download | scala-bf35b888e49afb245883571cc00cbb5ec7341f24.tar.gz scala-bf35b888e49afb245883571cc00cbb5ec7341f24.tar.bz2 scala-bf35b888e49afb245883571cc00cbb5ec7341f24.zip |
fixed several problems with cyclic references u...
fixed several problems with cyclic references uncovered by experimenting
with collections. Added early type definitions.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 12af98f91d..73bed5c8e4 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2270,18 +2270,20 @@ trait Parsers extends NewScanners with MarkupParsers { // @S: pre template body cannot stub like post body can! val (self, body) = templateBody(true) if (inToken == WITH && self.isEmpty) { - val vdefs: List[ValDef] = body flatMap { + val earlyDefs: List[Tree] = body flatMap { case vdef @ ValDef(mods, name, tpt, rhs) if !(mods hasFlag Flags.DEFERRED) => List(copy.ValDef(vdef, mods | Flags.PRESUPER, name, tpt, rhs)) + case tdef @ TypeDef(mods, name, tparams, rhs) => + List(copy.TypeDef(tdef, mods | Flags.PRESUPER, name, tparams, rhs)) case stat if !stat.isEmpty => - syntaxError(stat.pos, "only concrete field definitions allowed in early object initialization section", false) + syntaxError(stat.pos, "only type definitions and concrete field definitions allowed in early object initialization section", false) List() case _ => List() } inNextToken val (parents, argss) = templateParents(isTrait) val (self1, body1) = templateBodyOpt(isTrait) - (parents, argss, self1, vdefs ::: body1) + (parents, argss, self1, earlyDefs ::: body1) } else { (List(), List(List()), self, body) } |