From 9ea3a4ac2cb36ee8519deab04fd1bd6be81a89cb Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 27 Sep 2013 09:20:48 -0700 Subject: SI-6762 rename emptyValDef to noSelfType. Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something. --- src/compiler/scala/reflect/macros/compiler/Resolvers.scala | 2 +- src/compiler/scala/reflect/reify/codegen/GenTrees.scala | 4 ++-- src/compiler/scala/reflect/reify/phases/Reshape.scala | 2 +- src/compiler/scala/reflect/reify/utils/Extractors.scala | 4 ++-- src/compiler/scala/tools/nsc/ast/Printers.scala | 2 +- src/compiler/scala/tools/nsc/ast/TreeGen.scala | 2 +- src/compiler/scala/tools/nsc/ast/Trees.scala | 2 +- src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 12 ++++++------ src/compiler/scala/tools/nsc/javac/JavaParsers.scala | 4 ++-- src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 6 +++--- src/compiler/scala/tools/nsc/transform/Erasure.scala | 2 +- src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 4 ++-- src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 4 ++-- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Unapplies.scala | 2 +- src/compiler/scala/tools/reflect/ToolBoxFactory.scala | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala index 3025eb52a1..46c4e24817 100644 --- a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala +++ b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala @@ -57,7 +57,7 @@ trait Resolvers { val contextField = mkContextValDef(PARAMACCESSOR) val contextParam = mkContextValDef(PARAM | PARAMACCESSOR) val invokerCtor = DefDef(Modifiers(), nme.CONSTRUCTOR, Nil, List(List(contextParam)), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))) - val invoker = atPos(bundleClass.pos)(ClassDef(NoMods, invokerName, Nil, Template(List(Ident(bundleClass)), emptyValDef, List(contextField, invokerCtor)))) + val invoker = atPos(bundleClass.pos)(ClassDef(NoMods, invokerName, Nil, Template(List(Ident(bundleClass)), noSelfType, List(contextField, invokerCtor)))) currentRun.compileLate(PackageDef(invokerPid, List(invoker))) } diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala index 9de8451873..a09acc04b8 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala @@ -71,8 +71,8 @@ trait GenTrees { def reifyTreeSyntactically(tree: Tree) = tree match { case global.EmptyTree => reifyMirrorObject(EmptyTree) - case global.emptyValDef => - mirrorSelect(nme.emptyValDef) + case global.noSelfType => + mirrorSelect(nme.noSelfType) case global.pendingSuperCall => mirrorSelect(nme.pendingSuperCall) case Literal(const @ Constant(_)) => diff --git a/src/compiler/scala/reflect/reify/phases/Reshape.scala b/src/compiler/scala/reflect/reify/phases/Reshape.scala index 7610df67dc..fff6978653 100644 --- a/src/compiler/scala/reflect/reify/phases/Reshape.scala +++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala @@ -169,7 +169,7 @@ trait Reshape { private def toPreTyperCompoundTypeTree(ctt: CompoundTypeTree): Tree = { val CompoundTypeTree(tmpl @ Template(parents, self, stats)) = ctt if (stats.nonEmpty) CannotReifyCompoundTypeTreeWithNonEmptyBody(ctt) - assert(self eq emptyValDef, self) + assert(self eq noSelfType, self) val att = tmpl.attachments.get[CompoundTypeTreeOriginalAttachment] val CompoundTypeTreeOriginalAttachment(parents1, stats1) = att.getOrElse(CompoundTypeTreeOriginalAttachment(parents, stats)) CompoundTypeTree(Template(parents1, self, stats1)) diff --git a/src/compiler/scala/reflect/reify/utils/Extractors.scala b/src/compiler/scala/reflect/reify/utils/Extractors.scala index 9af8f2de2a..d052127956 100644 --- a/src/compiler/scala/reflect/reify/utils/Extractors.scala +++ b/src/compiler/scala/reflect/reify/utils/Extractors.scala @@ -75,12 +75,12 @@ trait Extractors { newTypeName(global.currentUnit.fresh.newName(flavor.toString)), List(), Template(List(Ident(reifierBase)), - emptyValDef, + noSelfType, List( DefDef(NoMods, nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))), DefDef(NoMods, reifierName, - List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(reifierUniverse), Ident(SingletonClass)), emptyValDef, List()))))), + List(TypeDef(Modifiers(PARAM), tparamu, List(), TypeBoundsTree(Ident(NothingClass), CompoundTypeTree(Template(List(Ident(reifierUniverse), Ident(SingletonClass)), noSelfType, List()))))), List(List(ValDef(Modifiers(PARAM), nme.MIRROR_UNTYPED, AppliedTypeTree(Ident(MirrorClass), List(Ident(tparamu))), EmptyTree))), reifierTpt, reifierBody)))) Block(tpec, ApplyConstructor(Ident(tpec.name), List())) diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala index 89652c5a20..c31b5e2c0e 100644 --- a/src/compiler/scala/tools/nsc/ast/Printers.scala +++ b/src/compiler/scala/tools/nsc/ast/Printers.scala @@ -20,7 +20,7 @@ trait Printers extends scala.reflect.internal.Printers { this: Global => printTree( if (tree.isDef && tree.symbol != NoSymbol && tree.symbol.isInitialized) { tree match { - case ClassDef(_, _, _, impl @ Template(ps, emptyValDef, body)) + case ClassDef(_, _, _, impl @ Template(ps, noSelfType, body)) if (tree.symbol.thisSym != tree.symbol) => ClassDef(tree.symbol, Template(ps, ValDef(tree.symbol.thisSym), body)) case ClassDef(_, _, _, impl) => ClassDef(tree.symbol, impl) diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index 7122e864a4..28b127698f 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -261,7 +261,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL { */ def mkAnonymousNew(stats: List[Tree]): Tree = { val stats1 = if (stats.isEmpty) List(Literal(Constant(()))) else stats - mkNew(Nil, emptyValDef, stats1, NoPosition, NoPosition) + mkNew(Nil, noSelfType, stats1, NoPosition, NoPosition) } def mkSyntheticParam(pname: TermName) = diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 381ffb1ed9..bdff5e1344 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -70,7 +70,7 @@ trait Trees extends scala.reflect.internal.Trees { self: Global => ClassDef(sym, gen.mkTemplate(sym.info.parents map TypeTree, - if (sym.thisSym == sym || phase.erasedTypes) emptyValDef else ValDef(sym.thisSym), + if (sym.thisSym == sym || phase.erasedTypes) noSelfType else ValDef(sym.thisSym), constrMods, vparamss, body, superPos)) } diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index a894e38ab4..a7790bec43 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -217,7 +217,7 @@ self => override def blockExpr(): Tree = skipBraces(EmptyTree) - override def templateBody(isPre: Boolean) = skipBraces((emptyValDef, EmptyTree.asList)) + override def templateBody(isPre: Boolean) = skipBraces((noSelfType, EmptyTree.asList)) } class UnitParser(override val unit: global.CompilationUnit, patches: List[BracePatch]) extends SourceFileParser(unit.source) { uself => @@ -429,7 +429,7 @@ self => // object Main def moduleName = newTermName(ScriptRunner scriptMain settings) - def moduleBody = Template(atInPos(scalaAnyRefConstr) :: Nil, emptyValDef, List(emptyInit, mainDef)) + def moduleBody = Template(atInPos(scalaAnyRefConstr) :: Nil, noSelfType, List(emptyInit, mainDef)) def moduleDef = ModuleDef(NoMods, moduleName, moduleBody) // package { ... } @@ -958,7 +958,7 @@ self => // it still gets a CompoundTypeTree. ts.toList match { case tp :: Nil if !hasRefinement => tp // single type, no refinement, already positioned - case tps => atPos(t.pos.startOrPoint)(CompoundTypeTree(Template(tps, emptyValDef, refinements))) + case tps => atPos(t.pos.startOrPoint)(CompoundTypeTree(Template(tps, noSelfType, refinements))) } } @@ -2796,7 +2796,7 @@ self => if (in.token == LBRACE) { // @S: pre template body cannot stub like post body can! val (self, body) = templateBody(isPre = true) - if (in.token == WITH && (self eq emptyValDef)) { + if (in.token == WITH && (self eq noSelfType)) { val earlyDefs: List[Tree] = body.map(ensureEarlyDef).filter(_.nonEmpty) in.nextToken() val parents = templateParents() @@ -2883,7 +2883,7 @@ self => if (parenMeansSyntaxError) syntaxError(s"traits or objects may not have parameters", skipIt = true) else abort("unexpected opening parenthesis") } - (emptyValDef, List()) + (noSelfType, List()) } } @@ -2939,7 +2939,7 @@ self => * @param isPre specifies whether in early initializer (true) or not (false) */ def templateStatSeq(isPre : Boolean): (ValDef, List[Tree]) = checkNoEscapingPlaceholders { - var self: ValDef = emptyValDef + var self: ValDef = noSelfType var firstOpt: Option[Tree] = None if (isExprIntro) { in.flushDoc diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index 239ecb4f8a..c34ff0ce97 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -118,7 +118,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def makeTemplate(parents: List[Tree], stats: List[Tree]) = Template( parents, - emptyValDef, + noSelfType, if (treeInfo.firstConstructor(stats) == EmptyTree) makeConstructor(List()) :: stats else stats) @@ -417,7 +417,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { } val ts = buf.toList if (ts.tail.isEmpty) ts.head - else CompoundTypeTree(Template(ts, emptyValDef, List())) + else CompoundTypeTree(Template(ts, noSelfType, List())) } def formalParams(): List[ValDef] = { diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index d9d08dde1e..2b7c6cca2c 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -249,7 +249,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => private def ifaceMemberDef(tree: Tree): Tree = createMemberDef(tree, true)(t => DefDef(t.symbol, EmptyTree)) private def ifaceTemplate(templ: Template): Template = - treeCopy.Template(templ, templ.parents, emptyValDef, templ.body map ifaceMemberDef) + treeCopy.Template(templ, templ.parents, noSelfType, templ.body map ifaceMemberDef) /** Transforms the member tree containing the implementation * into a member of the impl class. @@ -280,7 +280,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos) { val templ1 = ( - Template(templ.parents, emptyValDef, addMixinConstructorDef(clazz, templ.body map implMemberDef)) + Template(templ.parents, noSelfType, addMixinConstructorDef(clazz, templ.body map implMemberDef)) setSymbol clazz.newLocalDummy(templ.pos) ) templ1.changeOwner(templ.symbol.owner -> clazz, templ.symbol -> templ1.symbol) @@ -338,7 +338,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => deriveDefDef(tree)(addMixinConstructorCalls(_, sym.owner)) // (3) case Template(parents, self, body) => val parents1 = sym.owner.info.parents map (t => TypeTree(t) setPos tree.pos) - treeCopy.Template(tree, parents1, emptyValDef, body) + treeCopy.Template(tree, parents1, noSelfType, body) case This(_) if sym.needsImplClass => val impl = implClass(sym) var owner = currentOwner diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 28db6a4f6d..2d005b26e3 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -1205,7 +1205,7 @@ abstract class Erasure extends AddInterfaces assert(!currentOwner.isImplClass) //Console.println("checking no dble defs " + tree)//DEBUG checkNoDoubleDefs(tree.symbol.owner) - treeCopy.Template(tree, parents, emptyValDef, addBridges(body, currentOwner)) + treeCopy.Template(tree, parents, noSelfType, addBridges(body, currentOwner)) case Match(selector, cases) => Match(Typed(selector, TypeTree(selector.tpe)), cases) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 5a440039d6..2d4269a3bc 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1844,7 +1844,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { mbrs += ValDef(m).setType(NoType) } else if (m.isClass) { // mbrs += -// ClassDef(m, Template(m.info.parents map TypeTree, emptyValDef, List()) +// ClassDef(m, Template(m.info.parents map TypeTree, noSelfType, List()) // .setSymbol(m.newLocalDummy(m.pos))) // log("created synthetic class: " + m.fullName) } @@ -1866,7 +1866,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { for (((sym1, env), specCls) <- specializedClass if sym1 == tree.symbol) yield { debuglog("created synthetic class: " + specCls + " of " + sym1 + " in " + pp(env)) val parents = specCls.info.parents.map(TypeTree) - ClassDef(specCls, atPos(impl.pos)(Template(parents, emptyValDef, List())) + ClassDef(specCls, atPos(impl.pos)(Template(parents, noSelfType, List())) .setSymbol(specCls.newLocalDummy(sym1.pos))) setPos tree.pos } case _ => Nil diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index cd2b9b3a97..315496e5f6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -49,7 +49,7 @@ trait Contexts { self: Analyzer => private lazy val startContext = { NoContext.make( - Template(List(), emptyValDef, List()) setSymbol global.NoSymbol setType global.NoType, + Template(List(), noSelfType, List()) setSymbol global.NoSymbol setType global.NoType, rootMirror.RootClass, rootMirror.RootClass.info.decls) } @@ -615,7 +615,7 @@ trait Contexts { self: Analyzer => private def treeIdString = if (settings.uniqid.value) "#" + System.identityHashCode(tree).toString.takeRight(3) else "" private def treeString = tree match { case x: Import => "" + x - case Template(parents, `emptyValDef`, body) => + case Template(parents, `noSelfType`, body) => val pstr = if ((parents eq null) || parents.isEmpty) "Nil" else parents mkString " " val bstr = if (body eq null) "" else body.length + " stats" s"""Template($pstr, _, $bstr)""" diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 347426d42a..3bbf18fe3b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -841,7 +841,7 @@ trait Namers extends MethodSynthesis { // owner is the class with the self type def enterSelf(self: ValDef) { val ValDef(_, name, tpt, _) = self - if (self eq emptyValDef) + if (self eq noSelfType) return val hasName = name != nme.WILDCARD diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala index af19e3cf80..0c7c42db17 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala @@ -119,7 +119,7 @@ trait Unapplies extends ast.TreeDSL { ModuleDef( Modifiers(cdef.mods.flags & AccessFlags | SYNTHETIC, cdef.mods.privateWithin), cdef.name.toTermName, - gen.mkTemplate(parents, emptyValDef, NoMods, Nil, body, cdef.impl.pos.focus)) + gen.mkTemplate(parents, noSelfType, NoMods, Nil, body, cdef.impl.pos.focus)) } /** The apply method corresponding to a case class diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index 2d905d5436..b60db38ae7 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -222,7 +222,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => obj, gen.mkTemplate( List(TypeTree(ObjectTpe)), - emptyValDef, + noSelfType, NoMods, List(), List(methdef), -- cgit v1.2.3