diff options
Diffstat (limited to 'src/compiler')
19 files changed, 41 insertions, 210 deletions
diff --git a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala index 03d306f593..e4851632a5 100644 --- a/src/compiler/scala/reflect/macros/compiler/Resolvers.scala +++ b/src/compiler/scala/reflect/macros/compiler/Resolvers.scala @@ -9,7 +9,7 @@ trait Resolvers { import global._ import analyzer._ - import definitions.{EmptyPackageClass => _, _} + import definitions._ import treeInfo._ import gen._ private val runDefinitions = currentRun.runDefinitions diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index e7ac53c8fb..bb6a933d3f 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -139,7 +139,7 @@ class ScalaTool extends ScalaMatchingTask { val st = s.trim val stArray = st.split("=", 2) if (stArray.length == 2) { - if (input != "") List(Pair(stArray(0), stArray(1))) else Nil + if (input != "") List((stArray(0), stArray(1))) else Nil } else buildError("Property " + st + " is not formatted properly.") @@ -170,7 +170,7 @@ class ScalaTool extends ScalaMatchingTask { private def getProperties: String = properties.map({ - case Pair(name,value) => "-D" + name + "=\"" + value + "\"" + case (name,value) => "-D" + name + "=\"" + value + "\"" }).mkString("", " ", "") /*============================================================================*\ diff --git a/src/compiler/scala/tools/ant/sabbus/Compilers.scala b/src/compiler/scala/tools/ant/sabbus/Compilers.scala index b1994233e8..a0aad49f20 100644 --- a/src/compiler/scala/tools/ant/sabbus/Compilers.scala +++ b/src/compiler/scala/tools/ant/sabbus/Compilers.scala @@ -27,7 +27,7 @@ object Compilers extends scala.collection.DefaultMap[String, Compiler] { if (debug) println("Making compiler " + id) if (debug) println(" memory before: " + freeMemoryString) val comp = new Compiler(classpath, settings) - container += Pair(id, comp) + container(id) = comp if (debug) println(" memory after: " + freeMemoryString) comp } diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index ef4052d5f3..0429e295b4 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1774,10 +1774,12 @@ self => in.nextToken() if (in.token == SUBTYPE || in.token == SUPERTYPE) wildcardType(start) else atPos(start) { Bind(tpnme.WILDCARD, EmptyTree) } - case IDENTIFIER if nme.isVariableName(in.name) => - atPos(start) { Bind(identForType(), EmptyTree) } case _ => - typ() + typ() match { + case Ident(name: TypeName) if nme.isVariableName(name) => + atPos(start) { Bind(name, EmptyTree) } + case t => t + } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index 60f7857d0c..939641c3eb 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -69,7 +69,7 @@ abstract class Liveness { case STORE_LOCAL(local) if (!genSet(local)) => killSet = killSet + local case _ => () } - Pair(genSet, killSet) + (genSet, killSet) } override def run() { diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 7a53293384..f10d7cdc40 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -418,7 +418,7 @@ abstract class TypeFlowAnalysis { !blackballed(concreteMethod) } if(isCandidate) { - remainingCALLs += Pair(cm, CallsiteInfo(b, receiver, result.stack.length, concreteMethod)) + remainingCALLs(cm) = CallsiteInfo(b, receiver, result.stack.length, concreteMethod) } else { remainingCALLs.remove(cm) isOnWatchlist.remove(cm) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index c166b0bb7e..4f9f4c9e31 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -741,13 +741,13 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { var flatKeys: List[Int] = Nil var targets: List[asm.Label] = Nil var default: asm.Label = null - var switchBlocks: List[Pair[asm.Label, Tree]] = Nil + var switchBlocks: List[Tuple2[asm.Label, Tree]] = Nil // collect switch blocks and their keys, but don't emit yet any switch-block. for (caze @ CaseDef(pat, guard, body) <- tree.cases) { assert(guard == EmptyTree, guard) val switchBlockPoint = new asm.Label - switchBlocks ::= Pair(switchBlockPoint, body) + switchBlocks ::= (switchBlockPoint, body) pat match { case Literal(value) => flatKeys ::= value.intValue @@ -772,7 +772,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { // emit switch-blocks. val postMatch = new asm.Label for (sb <- switchBlocks.reverse) { - val Pair(caseLabel, caseBody) = sb + val (caseLabel, caseBody) = sb markProgramPoint(caseLabel) genLoad(caseBody, generatedType) bc goTo postMatch @@ -790,7 +790,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { genLoad(expr, expectedType) val end = currProgramPoint() if (emitVars) { // add entries to LocalVariableTable JVM attribute - for (Pair(sym, start) <- varsInScope.reverse) { emitLocalVarScope(sym, start, end) } + for ((sym, start) <- varsInScope.reverse) { emitLocalVarScope(sym, start, end) } } varsInScope = savedScope } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index c22ced26a5..64ed094a47 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -112,7 +112,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { val ta = exemplars.get(a) val tb = exemplars.get(b) - val res = Pair(ta.isInterface, tb.isInterface) match { + val res = (ta.isInterface, tb.isInterface) match { case (true, true) => // exercised by test/files/run/t4761.scala if (tb.isSubtypeOf(ta.c)) ta.c @@ -759,7 +759,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { def emitParamAnnotations(jmethod: asm.MethodVisitor, pannotss: List[List[AnnotationInfo]]) { val annotationss = pannotss map (_ filter shouldEmitAnnotation) if (annotationss forall (_.isEmpty)) return - for (Pair(annots, idx) <- annotationss.zipWithIndex; + for ((annots, idx) <- annotationss.zipWithIndex; annot <- annots) { val AnnotationInfo(typ, args, assocs) = annot assert(args.isEmpty, args) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 5fe03624cf..c921d11d00 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -436,7 +436,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { var labelDef: scala.collection.Map[Symbol, LabelDef] = null// (LabelDef-sym -> LabelDef) // bookkeeping the scopes of non-synthetic local vars, to emit debug info (`emitVars`). - var varsInScope: List[Pair[Symbol, asm.Label]] = null // (local-var-sym -> start-of-scope) + var varsInScope: List[Tuple2[Symbol, asm.Label]] = null // (local-var-sym -> start-of-scope) // helpers around program-points. def lastInsn: asm.tree.AbstractInsnNode = { diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala index 916d118b6e..5be5abd895 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala @@ -90,11 +90,11 @@ abstract class BCodeTypes extends BCodeIdiomatic { ) boxResultType = - for(Pair(csym, msym) <- currentRun.runDefinitions.boxMethod) + for((csym, msym) <- currentRun.runDefinitions.boxMethod) yield (msym -> classLiteral(primitiveTypeMap(csym))) unboxResultType = - for(Pair(csym, msym) <- currentRun.runDefinitions.unboxMethod) + for((csym, msym) <- currentRun.runDefinitions.unboxMethod) yield (msym -> primitiveTypeMap(csym)) // boxed classes are looked up in the `exemplars` map by jvmWiseLUB(). diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 5e885fdd04..e92f8c2541 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -293,7 +293,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def inameToSymbol(iname: String): Symbol = { val name = global.newTypeName(iname) val res0 = - if (nme.isModuleName(name)) rootMirror.getModule(name.dropModule) + if (nme.isModuleName(name)) rootMirror.getModuleByName(name.dropModule) else rootMirror.getClassByName(name.replace('/', '.')) // TODO fails for inner classes (but this hasn't been tested). assert(res0 != NoSymbol) val res = jsymbol(res0) @@ -335,7 +335,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { assert(a.isClass) assert(b.isClass) - val res = Pair(a.isInterface, b.isInterface) match { + val res = (a.isInterface, b.isInterface) match { case (true, true) => global.lub(List(a.tpe, b.tpe)).typeSymbol // TODO assert == firstCommonSuffix of resp. parents case (true, false) => @@ -1014,7 +1014,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def emitParamAnnotations(jmethod: asm.MethodVisitor, pannotss: List[List[AnnotationInfo]]) { val annotationss = pannotss map (_ filter shouldEmitAnnotation) if (annotationss forall (_.isEmpty)) return - for (Pair(annots, idx) <- annotationss.zipWithIndex; + for ((annots, idx) <- annotationss.zipWithIndex; annot <- annots) { val AnnotationInfo(typ, args, assocs) = annot assert(args.isEmpty, args) @@ -2156,7 +2156,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def getMerged(): scala.collection.Map[Local, List[Interval]] = { // TODO should but isn't: unbalanced start(s) of scope(s) - val shouldBeEmpty = pending filter { p => val Pair(_, st) = p; st.nonEmpty } + val shouldBeEmpty = pending filter { p => val (_, st) = p; st.nonEmpty } val merged = mutable.Map[Local, List[Interval]]() def addToMerged(lv: Local, start: Label, end: Label) { val intv = Interval(start, end) @@ -2169,7 +2169,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { (b) take the latest end (onePastLast if none available) (c) merge the thus made-up interval */ - for(Pair(k, st) <- shouldBeEmpty) { + for((k, st) <- shouldBeEmpty) { var start = st.toList.sortBy(_.getOffset).head if(merged.isDefinedAt(k)) { val balancedStart = merged(k).head.lstart @@ -2206,25 +2206,25 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } // adding non-param locals var anonCounter = 0 - var fltnd: List[Triple[String, Local, Interval]] = Nil - for(Pair(local, ranges) <- scoping.getMerged()) { + var fltnd: List[Tuple3[String, Local, Interval]] = Nil + for((local, ranges) <- scoping.getMerged()) { var name = javaName(local.sym) if (name == null) { anonCounter += 1 name = "<anon" + anonCounter + ">" } for(intrvl <- ranges) { - fltnd ::= Triple(name, local, intrvl) + fltnd ::= (name, local, intrvl) } } // quest for deterministic output that Map.toList doesn't provide (so that ant test.stability doesn't complain). val srtd = fltnd.sortBy { kr => - val Triple(name: String, _, intrvl: Interval) = kr + val (name: String, _, intrvl: Interval) = kr - Triple(intrvl.start, intrvl.end - intrvl.start, name) // ie sort by (start, length, name) + (intrvl.start, intrvl.end - intrvl.start, name) // ie sort by (start, length, name) } - for(Triple(name, local, Interval(start, end)) <- srtd) { + for((name, local, Interval(start, end)) <- srtd) { jmethod.visitLocalVariable(name, descriptor(local.kind), null, start, end, indexOf(local)) } // "There may be no more than one LocalVariableTable attribute per local variable in the Code attribute" diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 0cfcea87f8..0f317422ac 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -119,7 +119,7 @@ abstract class DeadCodeElimination extends SubComponent { m foreachBlock { bb => useful(bb) = new mutable.BitSet(bb.size) var rd = rdef.in(bb) - for (Pair(i, idx) <- bb.toList.zipWithIndex) { + for ((i, idx) <- bb.toList.zipWithIndex) { // utility for adding to worklist def moveToWorkList() = moveToWorkListIf(cond = true) @@ -137,7 +137,7 @@ abstract class DeadCodeElimination extends SubComponent { i match { case LOAD_LOCAL(_) => - defs = defs + Pair(((bb, idx)), rd.vars) + defs = defs + (((bb, idx), rd.vars)) moveToWorkListIf(cond = false) case STORE_LOCAL(l) => @@ -350,7 +350,7 @@ abstract class DeadCodeElimination extends SubComponent { val oldInstr = bb.toList bb.open() bb.clear() - for (Pair(i, idx) <- oldInstr.zipWithIndex) { + for ((i, idx) <- oldInstr.zipWithIndex) { if (useful(bb)(idx)) { debuglog(" * " + i + " is useful") bb.emit(i, i.pos) diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 1578caff26..d194c095f8 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -144,7 +144,7 @@ object Plugin { // (j, Try(descriptor)) def required(j: Path) = j -> loadDescriptionFromJar(j) - type Paired = Pair[Path, Try[PluginDescription]] + type Paired = Tuple2[Path, Try[PluginDescription]] val included: List[Paired] = (dirs flatMap (_ ifDirectory scan)).flatten val exploded: List[Paired] = jars flatMap (_ ifDirectory explode) val explicit: List[Paired] = jars flatMap (_ ifFile required) diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index 0544da5d3c..68362c066d 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -80,10 +80,4 @@ abstract class Reporter { WARNING.count = 0 cancelled = false } - - // sbt compat - @deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0") - def countElementsAsString(n: Int, elements: String): String = StringOps.countElementsAsString(n, elements) - @deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0") - def countAsString(n: Int): String = StringOps.countAsString(n) } diff --git a/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala b/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala deleted file mode 100644 index 3aecc06b1e..0000000000 --- a/src/compiler/scala/tools/nsc/scratchpad/Mixer.scala +++ /dev/null @@ -1,99 +0,0 @@ -package scala.tools.nsc.scratchpad - -import java.io.{FileInputStream, InputStreamReader, IOException} - -import scala.collection.mutable.ArrayBuffer - -@deprecated("SI-6458: Instrumentation logic will be moved out of the compiler.","2.10.0") -class Mixer { - - protected val stdSeparator = "//> " - protected val ctdSeparator = "//| " - protected val sepColumn = 50 - protected val tabInc = 8 - - type Comments = Seq[(Int, Array[Char])] - - def parseComments(comments: Array[Char]): Iterator[(Int, Array[Char])] = new Iterator[(Int, Array[Char])] { - var idx = 0 - def hasNext = idx < comments.length - def next() = { - val nextSpace = comments indexOf (' ', idx) - var nextNL = comments indexOf ('\n', nextSpace + 1) - if (nextNL < 0) nextNL = comments.length - val result = - (new String(comments.slice(idx, nextSpace)).toInt, comments.slice(nextSpace + 1, nextNL)) - idx = nextNL + 1 - result - } - } - - def mix(source: Array[Char], comments: Array[Char]): Array[Char] = { - val mixed = new ArrayBuffer[Char] - var written = 0 - def align() = { - var idx = mixed.lastIndexOf('\n') + 1 - var col = 0 - while (idx < mixed.length) { - col = - if (mixed(idx) == '\t') (col / tabInc) * tabInc + tabInc - else col + 1 - idx += 1 - } - if (col > sepColumn) { - mixed += '\n' - col = 0 - } - while (col < sepColumn) { - mixed += ' ' - col += 1 - } - } - for ((offset, cs) <- parseComments(comments)) { - val sep = - if (written < offset) { - for (i <- written until offset) mixed += source(i) - written = offset - stdSeparator - } else { - mixed += '\n' - ctdSeparator - } - align() - mixed ++= sep ++= cs - } - mixed ++= source.view(written, source.length) - mixed.toArray - } - -} - -object Mixer extends Mixer { - - def contents(name: String): Array[Char] = { - val page = new Array[Char](2 << 14) - val buf = new ArrayBuffer[Char] - val in = new FileInputStream(name) - val rdr = new InputStreamReader(in) - var nread = 0 - do { - nread = rdr.read(page, 0, page.length) - buf ++= (if (nread == page.length) page else page.take(nread)) - } while (nread >= 0) - buf.toArray - } - - def main(args: Array[String]) { - val mixer = new Mixer - try { - require(args.length == 2, "required arguments: file1 file2") - val source = contents(args(0)) - val comments = contents(args(1)) - val mixed = mixer.mix(source, comments) - println(mixed.mkString) - } catch { - case ex: IOException => - println("error: "+ ex.getMessage) - } - } -} diff --git a/src/compiler/scala/tools/nsc/scratchpad/SourceInserter.scala b/src/compiler/scala/tools/nsc/scratchpad/SourceInserter.scala deleted file mode 100644 index 61c1717fea..0000000000 --- a/src/compiler/scala/tools/nsc/scratchpad/SourceInserter.scala +++ /dev/null @@ -1,21 +0,0 @@ -package scala.tools.nsc -package scratchpad - -import scala.reflect.internal.Chars._ - -@deprecated("SI-6458: Instrumentation logic will be moved out of the compiler.","2.10.0") -object SourceInserter { - def stripRight(cs: Array[Char]): Array[Char] = { - val lines = - new String(cs) split "\n" - def leftPart(str: String) = - (str split """//>|//\|""").head - def isContinuation(str: String) = - ((str contains "//>") || (str contains "//|")) && (leftPart(str) forall isWhitespace) - def stripTrailingWS(str: String) = - str take (str lastIndexWhere (!isWhitespace(_))) + 1 - val prefixes = - lines filterNot isContinuation map leftPart map stripTrailingWS - (prefixes mkString "\n").toArray - } -} diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index fa704adde2..8594309818 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -5051,7 +5051,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper // @M: fun is typed in TAPPmode because it is being applied to its actual type parameters val fun1 = typed(fun, mode.forFunMode | TAPPmode) - val tparams = fun1.symbol.typeParams + val tparams = if (fun1.symbol == null) Nil else fun1.symbol.typeParams //@M TODO: val undets_fun = context.undetparams ? // "do args first" (by restoring the context.undetparams) in order to maintain context.undetparams on the function side. diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala index cb46004174..4237f36ade 100644 --- a/src/compiler/scala/tools/nsc/util/package.scala +++ b/src/compiler/scala/tools/nsc/util/package.scala @@ -90,51 +90,22 @@ package object util { lazy val trace = new SimpleTracer(System.out) - @deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0") - val StringOps = scala.reflect.internal.util.StringOps - - @deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0") - type StringOps = scala.reflect.internal.util.StringOps - - @deprecated("scala.reflect.internal.util.WeakHashSet", "2.10.0") - type WeakHashSet[T <: AnyRef] = scala.reflect.internal.util.WeakHashSet[T] - - @deprecated("Moved to scala.reflect.internal.util.Position", "2.10.0") - val Position = scala.reflect.internal.util.Position - + // These four deprecated since 2.10.0 are still used in (at least) + // the sbt 0.12.4 compiler interface. @deprecated("Moved to scala.reflect.internal.util.Position", "2.10.0") type Position = scala.reflect.internal.util.Position - @deprecated("Moved to scala.reflect.internal.util.NoPosition", "2.10.0") val NoPosition = scala.reflect.internal.util.NoPosition - @deprecated("Moved to scala.reflect.internal.util.FakePos", "2.10.0") val FakePos = scala.reflect.internal.util.FakePos - @deprecated("Moved to scala.reflect.internal.util.FakePos", "2.10.0") type FakePos = scala.reflect.internal.util.FakePos - @deprecated("Moved to scala.reflect.internal.util.OffsetPosition", "2.10.0") - type OffsetPosition = scala.reflect.internal.util.OffsetPosition - + // These three were still used in scala-refactoring. @deprecated("Moved to scala.reflect.internal.util.RangePosition", "2.10.0") type RangePosition = scala.reflect.internal.util.RangePosition - @deprecated("Moved to scala.reflect.internal.util.SourceFile", "2.10.0") type SourceFile = scala.reflect.internal.util.SourceFile - - @deprecated("Moved to scala.reflect.internal.util.NoSourceFile", "2.10.0") - val NoSourceFile = scala.reflect.internal.util.NoSourceFile - - @deprecated("Moved to scala.reflect.internal.util.NoFile", "2.10.0") - val NoFile = scala.reflect.internal.util.NoFile - - @deprecated("Moved to scala.reflect.internal.util.ScriptSourceFile", "2.10.0") - val ScriptSourceFile = scala.reflect.internal.util.ScriptSourceFile - - @deprecated("Moved to scala.reflect.internal.util.ScriptSourceFile", "2.10.0") - type ScriptSourceFile = scala.reflect.internal.util.ScriptSourceFile - @deprecated("Moved to scala.reflect.internal.util.BatchSourceFile", "2.10.0") type BatchSourceFile = scala.reflect.internal.util.BatchSourceFile diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala index 3901184c25..126c14ac81 100644 --- a/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala +++ b/src/compiler/scala/tools/reflect/quasiquotes/Parsers.scala @@ -55,9 +55,7 @@ trait Parsers { self: Quasiquotes => def isHole(name: Name): Boolean = holeMap.contains(name) - override implicit def fresh: FreshNameCreator = new FreshNameCreator { - override def newName(prefix: String) = super.newName(nme.QUASIQUOTE_PREFIX + prefix) - } + override implicit def fresh: FreshNameCreator = new FreshNameCreator(nme.QUASIQUOTE_PREFIX) override val treeBuilder = new ParserTreeBuilder { override implicit def fresh: FreshNameCreator = parser.fresh @@ -189,19 +187,5 @@ trait Parsers { self: Quasiquotes => } } - // Extractor that matches names which were generated by call to - // freshTermName or freshTypeName within quasiquotes. Such names - // have qq$some$random$prefix$0 shape where qq$ part is added - // by modified fresh name creator in QuasiquoteParser. - object FreshName { - def unapply(name: Name): Option[String] = - name.toString.split("\\$").toSeq match { - case qq +: (middle :+ last) - if qq + "$" == nme.QUASIQUOTE_PREFIX - && Try(last.toInt).isSuccess && middle.nonEmpty => - Some(middle.mkString("", "$", "$")) - case _ => - None - } - } + object FreshName extends FreshNameExtractor(nme.QUASIQUOTE_PREFIX) }
\ No newline at end of file |