diff options
author | Paul Phillips <paulp@improving.org> | 2012-04-05 15:50:10 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-05 22:51:29 -0700 |
commit | 296b7061ccef8600c011140fa6fd64afec244ed0 (patch) | |
tree | 852bfad96dc8b980b18a7869640f4c400566baa5 /src/compiler/scala/tools/nsc/ast | |
parent | 2b89c3459d1d9a9aa9dd5aba75847274d6f74129 (diff) | |
download | scala-296b7061ccef8600c011140fa6fd64afec244ed0.tar.gz scala-296b7061ccef8600c011140fa6fd64afec244ed0.tar.bz2 scala-296b7061ccef8600c011140fa6fd64afec244ed0.zip |
A boatload of work on Symbols and Flags.
Finally my dream of orderliness is within sight.
It's all pretty self-explanatory. More polymorphism, more immutable
identity, more invariants.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/Reifiers.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 13 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Reifiers.scala b/src/compiler/scala/tools/nsc/ast/Reifiers.scala index 7ece8bbd31..04468a096d 100644 --- a/src/compiler/scala/tools/nsc/ast/Reifiers.scala +++ b/src/compiler/scala/tools/nsc/ast/Reifiers.scala @@ -199,7 +199,7 @@ trait Reifiers { self: Global => ValDef(NoMods, localName(sym), TypeTree(), Apply( Select(reify(sym.owner), "newNestedSymbol"), - List(reify(sym.name), reify(sym.pos), Literal(Constant(sym.flags))) + List(reify(sym.name), reify(sym.pos), Literal(Constant(sym.flags)), Literal(Constant(sym.isClass))) ) ) } diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala index 9f361e5bcc..569cb4977b 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala @@ -44,7 +44,7 @@ abstract class TreeInfo extends reflect.internal.TreeInfo { } def isInterface(mods: HasFlags, body: List[Tree]) = - mods.hasTraitFlag && (body forall isInterfaceMember) + mods.isTrait && (body forall isInterfaceMember) def isAllowedInUniversalTrait(stat: Tree): Boolean = stat match { case _: ValDef => false diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 45325b4694..fa2fc54ac0 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2600,7 +2600,6 @@ self => in.nextToken val nameOffset = in.offset val name = identForType() - def isTrait = mods.hasTraitFlag atPos(start, if (name == tpnme.ERROR) start else nameOffset) { savingClassContextBounds { @@ -2608,16 +2607,16 @@ self => val tparams = typeParamClauseOpt(name, contextBoundBuf) classContextBounds = contextBoundBuf.toList val tstart = in.offset :: classContextBounds.map(_.pos.startOrPoint) min; - if (!classContextBounds.isEmpty && isTrait) { + if (!classContextBounds.isEmpty && mods.isTrait) { syntaxError("traits cannot have type parameters with context bounds `: ...' nor view bounds `<% ...'", false) classContextBounds = List() } val constrAnnots = constructorAnnotations() val (constrMods, vparamss) = - if (isTrait) (Modifiers(Flags.TRAIT), List()) + if (mods.isTrait) (Modifiers(Flags.TRAIT), List()) else (accessModifierOpt(), paramClauses(name, classContextBounds, mods.isCase)) var mods1 = mods - if (isTrait) { + if (mods.isTrait) { if (settings.YvirtClasses && in.token == SUBTYPE) mods1 |= Flags.DEFERRED } else if (in.token == SUBTYPE) { syntaxError("classes are not allowed to be virtual", false) @@ -2709,7 +2708,7 @@ self => } def isInterface(mods: Modifiers, body: List[Tree]): Boolean = - mods.hasTraitFlag && (body forall treeInfo.isInterfaceMember) + mods.isTrait && (body forall treeInfo.isInterfaceMember) /** {{{ * ClassTemplateOpt ::= `extends' ClassTemplate | [[`extends'] TemplateBody] @@ -2719,9 +2718,9 @@ self => */ def templateOpt(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]], tstart: Int): Template = { val (parents0, argss, self, body) = ( - if (in.token == EXTENDS || in.token == SUBTYPE && mods.hasTraitFlag) { + if (in.token == EXTENDS || in.token == SUBTYPE && mods.isTrait) { in.nextToken() - template(mods.hasTraitFlag) + template(mods.isTrait) } else { newLineOptWhenFollowedBy(LBRACE) |