From 728775440ccd67928c25914a1e003ff9765ad80b Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 25 Oct 2009 06:00:59 +0000 Subject: Deprecation patrol. compile scalac with -deprecation and not cause any machines to catch fire. Most of the remaining warnings are glancing furtively at Tuple2, waiting for the moment to pounce. --- src/compiler/scala/tools/ant/FastScalac.scala | 34 ++++++++++++---------- src/compiler/scala/tools/nsc/Interpreter.scala | 9 +++--- .../scala/tools/nsc/ast/TreeBrowsers.scala | 24 +++++---------- src/compiler/scala/tools/nsc/ast/Trees.scala | 2 +- .../scala/tools/nsc/ast/parser/Parsers.scala | 5 +--- .../scala/tools/nsc/ast/parser/TreeBuilder.scala | 2 +- .../scala/tools/nsc/backend/icode/GenICode.scala | 6 ++-- .../scala/tools/nsc/backend/jvm/GenJVM.scala | 5 ++-- .../nsc/backend/opt/DeadCodeElimination.scala | 4 +-- .../scala/tools/nsc/backend/opt/Inliners.scala | 10 ++----- src/compiler/scala/tools/nsc/doc/ModelToXML.scala | 3 +- .../scala/tools/nsc/interactive/ContextTrees.scala | 2 +- src/compiler/scala/tools/nsc/io/Streamable.scala | 2 +- .../tools/nsc/reporters/AbstractReporter.scala | 16 +++++----- src/compiler/scala/tools/nsc/symtab/Symbols.scala | 2 +- .../scala/tools/nsc/transform/UnCurry.scala | 2 +- .../scala/tools/nsc/typechecker/Duplicators.scala | 7 ++--- .../scala/tools/nsc/typechecker/Implicits.scala | 2 +- .../scala/tools/nsc/typechecker/Namers.scala | 2 +- .../scala/tools/nsc/typechecker/Typers.scala | 4 +-- .../scala/tools/nsc/util/JavaCharArrayReader.scala | 4 +-- src/compiler/scala/tools/nsc/util/SourceFile.scala | 17 +++++------ 22 files changed, 74 insertions(+), 90 deletions(-) (limited to 'src/compiler/scala/tools') diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala index 1aca0b3c81..0317c91455 100644 --- a/src/compiler/scala/tools/ant/FastScalac.scala +++ b/src/compiler/scala/tools/ant/FastScalac.scala @@ -66,6 +66,7 @@ class FastScalac extends Scalac { /** Performs the compilation. */ override def execute() = { val (settings, sourceFiles, javaOnly) = initialize + val s = settings if (!sourceFiles.isEmpty && !javaOnly) { def trim(xs: List[String]) = xs filter (x => x.length > 0) @@ -74,22 +75,25 @@ class FastScalac extends Scalac { reset.value = resetCaches shutdown.value = shutdownServer + + val stringSettings = + List(s.outdir, s.classpath, s.bootclasspath, s.extdirs, s.encoding) map (x => "%s %s".format(x.name, x.value)) + + val serverOption = + serverAddr.toList map ("-server " + _) // '-server' option + + val choiceSettings = + List(s.debuginfo, s.target) map (x => "%s:%s".format(x.name, x.value)) + + val booleanSettings = + List(s.debug, s.deprecation, s.nopredefs, s.verbose, reset, shutdown) map (x => if (x.value) x.name else "") + + val phaseSetting = + List(settings.log) map (x => if (x.value.isEmpty) "" else "%s:%s".format(x.name, x.value)) + val cmdOptions = - // StringSetting - List.flatten( - List(settings.outdir, settings.classpath, settings.bootclasspath, - settings.extdirs, settings.encoding) map (s => List(s.name, s.value))) ::: - // '-server' option - (if (serverAddr.isEmpty) Nil else List("-server", serverAddr.get)) ::: - // ChoiceSetting - (List(settings.debuginfo, settings.target) map (s => s.name + ":" + s.value)) ::: - // BooleanSetting - trim( - List(settings.debug, settings.deprecation, settings.nopredefs, - settings.verbose, reset, shutdown) map (s => if (s.value) s.name else "")) ::: - // PhaseSetting - trim( - List(settings.log) map (s => if (s.value.isEmpty) "" else s.name + ":" + s.value)) + List(stringSettings, serverOption, choiceSettings, booleanSettings, phaseSetting) . + flatten . filterNot (_.isEmpty) val args = (cmdOptions ::: (sourceFiles map (_.toString))).toArray try { diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 9e2966e976..489ab1a3e0 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -808,11 +808,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) // very simple right now, will get more interesting def dumpTrees(xs: List[String]): String = { - val treestrs = - List.flatten( - for (x <- xs ; name <- nameOfIdent(x) ; req <- requestForName(name)) - yield req.trees - ) + val treestrs = ( + for (x <- xs ; name <- nameOfIdent(x) ; req <- requestForName(name)) + yield req.trees + ).flatten if (treestrs.isEmpty) "No trees found." else treestrs.map(t => t.toString + " (" + t.getClass.getSimpleName + ")\n").mkString diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index 58b0dce333..e6a247483d 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -419,20 +419,14 @@ abstract class TreeBrowsers { case ValDef(mods, name, tpe, rhs) => mods.annotations ::: List(tpe, rhs) - case DefDef(mods, name, tparams, vparams, tpe, rhs) => { - var children: List[Tree] = List() - children = tparams ::: children - children = List.flatten(vparams) ::: children - mods.annotations ::: tpe :: rhs :: children - } + case DefDef(mods, name, tparams, vparams, tpe, rhs) => + mods.annotations ::: tpe :: rhs :: vparams.flatten ::: tparams case TypeDef(mods, name, tparams, rhs) => mods.annotations ::: rhs :: tparams // @M: was List(rhs, lobound) - case Import(expr, selectors) => { - var children: List[Tree] = List(expr) - children - } + case Import(expr, selectors) => + List(expr) case CaseDef(pat, guard, body) => List(pat, guard, body) @@ -542,12 +536,10 @@ abstract class TreeBrowsers { /** Return a textual representation of this t's symbol */ def symbolText(t: Tree): String = { - var prefix = "" - - if (t.hasSymbol) - prefix = "[has] " - if (t.isDef) - prefix = "[defines] " + val prefix = + if (t.hasSymbol) "[has] " + else if (t.isDef) "[defines] " + else "" prefix + t.symbol } diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 8ae59fb9e6..6bd3fee3fb 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -655,7 +655,7 @@ trait Trees { val vparamss2 = vparamss map (vps => vps map { vd => treeCopy.ValDef(vd, vd.mods &~ DEFAULTPARAM, vd.name, vd.tpt, EmptyTree) }) - Template(parents, self, gvdefs ::: List.flatten(vparamss2) ::: constrs ::: etdefs ::: rest) + Template(parents, self, gvdefs ::: vparamss2.flatten ::: constrs ::: etdefs ::: rest) } /** Block of expressions (semicolon separated expressions) */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index c2cb2128ee..d17018d47e 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -273,10 +273,7 @@ self => def incompleteInputError(msg: String): Unit def deprecationWarning(offset: Int, msg: String): Unit private def syntaxError(pos: Position, msg: String, skipIt: Boolean) { - pos.offset match { - case None => syntaxError(msg,skipIt) - case Some(offset) => syntaxError(offset, msg, skipIt) - } + syntaxError(pos pointOrElse in.offset, msg, skipIt) } def syntaxError(offset: Int, msg: String): Unit def syntaxError(msg: String, skipIt: Boolean) { diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 0b917fa925..29a9599744 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -378,7 +378,7 @@ abstract class TreeBuilder { val rhss = valeqs map { case ValEq(_, _, rhs) => rhs } val defpat1 = makeBind(pat) val defpats = pats map makeBind - val pdefs = List.flatten(List.map2(defpats, rhss)(makePatDef)) + val pdefs = (List.map2(defpats, rhss)(makePatDef)).flatten val ids = (defpat1 :: defpats) map makeValue val rhs1 = makeForYield( List(ValFrom(pos, defpat1, rhs)), diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index bbe98f7b3f..6f9589e785 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -1064,9 +1064,9 @@ abstract class GenICode extends SubComponent { val Some(l) = ctx.method.lookupLocal(param.head) ctx1 = genLoad(arg.head, ctx1, l.kind) if (param.head.name == nme.THIS) - STORE_THIS(toTypeKind(ctx1.clazz.symbol.tpe)).setPos(arg.head.pos) +: stores + STORE_THIS(toTypeKind(ctx1.clazz.symbol.tpe)).setPos(arg.head.pos) +=: stores else { - STORE_LOCAL(l).setPos(arg.head.pos) +: stores + STORE_LOCAL(l).setPos(arg.head.pos) +=: stores } } arg = arg.tail @@ -2142,7 +2142,7 @@ abstract class GenICode extends SubComponent { locals -= l /** Return all locals that are in scope. */ - def varsInScope: Buffer[Local] = outer.varsInScope.clone() ++ locals + def varsInScope: Buffer[Local] = outer.varsInScope.clone() ++= locals override def toString() = outer.toString() + locals.mkString("[", ", ", "]") diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 1f8b855acb..415a56712a 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -833,8 +833,9 @@ abstract class GenJVM extends SubComponent { def makeLabels(bs: List[BasicBlock]) = { if (settings.debug.value) - log("Making labels for: " + method); - HashMap.empty ++ bs.zip(bs map (b => jcode.newLabel)) + log("Making labels for: " + method) + + HashMap(bs map (b => b -> jcode.newLabel) : _*) } isModuleInitialized = false diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 2ca1e322e5..9f5701ff45 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -83,8 +83,8 @@ abstract class DeadCodeElimination extends SubComponent { mark sweep(m) accessedLocals = accessedLocals.removeDuplicates - if ((m.locals -- accessedLocals).length > 0) { - log("Removed dead locals: " + (m.locals -- accessedLocals)) + if (m.locals diff accessedLocals nonEmpty) { + log("Removed dead locals: " + (m.locals diff accessedLocals)) m.locals = accessedLocals.reverse } } diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index a93d6b1a34..321b27b030 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -70,12 +70,8 @@ abstract class Inliners extends SubComponent { block: BasicBlock, instr: Instruction, callee: IMethod) { - log("Inlining " + callee + " in " + caller + " at pos: " + - (try { - instr.pos.offset.get - } catch { - case _ => "" - })); + def posToStr(pos: util.Position) = if (pos.isDefined) pos.point.toString else "" + log("Inlining " + callee + " in " + caller + " at pos: " + posToStr(instr.pos)) val targetPos = instr.pos val a = new analysis.MethodTFA(callee) @@ -86,7 +82,7 @@ abstract class Inliners extends SubComponent { /* Map 'original' blocks to the ones inlined in the caller. */ val inlinedBlock: Map[BasicBlock, BasicBlock] = new HashMap - val varsInScope: Set[Local] = new HashSet[Local] ++ block.varsInScope.iterator + val varsInScope: Set[Local] = HashSet() ++= block.varsInScope val instrBefore = block.toList.takeWhile { case i @ SCOPE_ENTER(l) => varsInScope += l diff --git a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala index 3682266a41..19d67ab2fd 100644 --- a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala +++ b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala @@ -299,8 +299,7 @@ trait ModelToXML extends ModelExtractor { protected def decodeOption(tag: String, string: String): NodeSeq = {Text(string + " - ")}; - protected def decodeTag(tag: String): String = - "" + Character.toUpperCase(tag.charAt(0)) + tag.substring(1) + protected def decodeTag(tag: String): String = tag.capitalize def shortHeader(entity: Entity)(implicit from: Frame): NodeSeq = diff --git a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala index 1239ae514a..af50e4e468 100644 --- a/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala +++ b/src/compiler/scala/tools/nsc/interactive/ContextTrees.scala @@ -93,7 +93,7 @@ trait ContextTrees { self: Global => else if (contexts(hi).pos properlyIncludes cpos) // fast path w/o search addContext(contexts(hi).children, context, cpos) else if (cpos precedes contexts(0).pos) - new ContextTree(cpos, context) +: contexts + new ContextTree(cpos, context) +=: contexts else { def insertAt(idx: Int): Boolean = { val oldpos = contexts(idx).pos diff --git a/src/compiler/scala/tools/nsc/io/Streamable.scala b/src/compiler/scala/tools/nsc/io/Streamable.scala index 07a07a7cfb..49a26e436b 100644 --- a/src/compiler/scala/tools/nsc/io/Streamable.scala +++ b/src/compiler/scala/tools/nsc/io/Streamable.scala @@ -42,7 +42,7 @@ object Streamable def toByteArray(): Array[Byte] = { // if we don't know the length, fall back on relative inefficiency if (length == -1L) - return (new ArrayBuffer[Byte]() ++ bytes()).toArray + return (new ArrayBuffer[Byte]() ++= bytes()).toArray val arr = new Array[Byte](length.toInt) val len = arr.length diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index 941b698b2a..f8d40a13f8 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -50,12 +50,12 @@ abstract class AbstractReporter extends Reporter { * @param pos ... * @return true if pos was already logged. */ - private def testAndLog(pos: Position, severity: Severity): Boolean = { - if (pos eq null) return false - if (pos.offset.isEmpty) return false - val fpos = pos.focus - if ((positions contains fpos) && positions(fpos) >= severity) return true - positions += (fpos -> severity) - false - } + private def testAndLog(pos: Position, severity: Severity): Boolean = + pos != null && pos.isDefined && { + val fpos = pos.focus + (positions get fpos) match { + case Some(level) if level >= severity => true + case _ => positions += (fpos -> severity) ; false + } + } } diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index e86420de51..0d3be5bd2e 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -71,7 +71,7 @@ trait Symbols { def setPos(pos: Position): this.type = { this.rawpos = pos; this } def namePos(source: BatchSourceFile) = { - val pos: Int = this.pos.offset.getOrElse(-1) + val pos: Int = this.pos.pointOrElse(-1) val buf = source.content if (pos == -1) -1 else if (isTypeParameter) pos - name.length diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index d87fadf3dd..74a09b46d0 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -639,7 +639,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { case None => rhs case Some(k) => atPos(rhs.pos)(nonLocalReturnTry(rhs, k, tree.symbol)) } - treeCopy.DefDef(tree, mods, name, tparams, List(List.flatten(vparamss)), tpt, rhs1) + treeCopy.DefDef(tree, mods, name, tparams, List(vparamss.flatten), tpt, rhs1) case Try(body, catches, finalizer) => // If warnings are enabled, alert about promiscuously catching cases. if (settings.YwarnCatches.value) diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index 0c0f1bf305..c9a2a377c1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -127,10 +127,9 @@ abstract class Duplicators extends Analyzer { ldef.symbol = newsym log("newsym: " + newsym + " info: " + newsym.info) - case DefDef(_, _, _, _, _, rhs) => + case DefDef(_, _, tparams, vparamss, _, rhs) => // invalidate parameters - invalidate(tree.asInstanceOf[DefDef].tparams) - invalidate(List.flatten(tree.asInstanceOf[DefDef].vparamss)) + invalidate(tparams ::: vparamss.flatten) tree.symbol = NoSymbol case _ => @@ -148,7 +147,7 @@ abstract class Duplicators extends Analyzer { oldClassOwner = oldThis newClassOwner = newThis invalidate(ddef.tparams) - for (vdef <- List.flatten(ddef.vparamss)) { + for (vdef <- ddef.vparamss.flatten) { invalidate(vdef) vdef.tpe = null } diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 023c5c2920..a32f945553 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -473,7 +473,7 @@ self: Analyzer => } } def comesBefore(sym: Symbol, owner: Symbol) = - sym.pos.offset.getOrElse(0) < owner.pos.offset.getOrElse(Integer.MAX_VALUE) && + sym.pos.pointOrElse(0) < owner.pos.pointOrElse(Integer.MAX_VALUE) && !(owner.ownerChain contains sym) sym.isInitialized || diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 91b0facd92..273d0e42a8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -480,7 +480,7 @@ trait Namers { self: Analyzer => "to non-private fields") else { val flags = mods.flags & (DEFERRED | OVERRIDE | STATIC) - val beanName = name(0).toString.toUpperCase + name.subName(1, name.length) + val beanName = name.toString.capitalize val getterName = if (hasBoolBP) "is" + beanName else "get" + beanName diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 15ac8cdf67..9b3bca2b55 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1372,7 +1372,7 @@ trait Typers { self: Analyzer => } if (!forMSIL && (value.hasAnnotation(BeanPropertyAttr) || value.hasAnnotation(BooleanBeanPropertyAttr))) { - val nameSuffix = name(0).toString.toUpperCase + name.subName(1, name.length) + val nameSuffix = name.toString().capitalize val beanGetterName = (if (value.hasAnnotation(BooleanBeanPropertyAttr)) "is" else "get") + nameSuffix @@ -1933,7 +1933,7 @@ trait Typers { self: Analyzer => val result = checkDead(localTyper.typed(stat)) if (treeInfo.isSelfOrSuperConstrCall(result)) { context.inConstructorSuffix = true - if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.offset.getOrElse(0) >= exprOwner.enclMethod.pos.offset.getOrElse(0)) + if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.pointOrElse(0) >= exprOwner.enclMethod.pos.pointOrElse(0)) error(stat.pos, "called constructor's definition must precede calling constructor's definition") } result diff --git a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala index 31024b69d2..9dce09ad7e 100644 --- a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala +++ b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala @@ -9,10 +9,10 @@ package util import scala.tools.nsc.util.SourceFile.{LF, FF, CR, SU} -class JavaCharArrayReader(buf: RandomAccessSeq[Char], start: Int, /* startline: int, startcol: int, */ +class JavaCharArrayReader(buf: IndexedSeq[Char], start: Int, /* startline: int, startcol: int, */ decodeUni: Boolean, error: String => Unit) extends Iterator[Char] with Cloneable { - def this(buf: RandomAccessSeq[Char], decodeUni: Boolean, error: String => Unit) = + def this(buf: IndexedSeq[Char], decodeUni: Boolean, error: String => Unit) = this(buf, 0, /* 1, 1, */ decodeUni, error) /** produce a duplicate of this char array reader which starts reading diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 9df275fa2f..90b82dab76 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -186,10 +186,10 @@ extends BatchSourceFile(name, contents) this("(virtual file)", components.toList:_*) override def positionInUltimateSource(position: Position) = { - if (position.offset.isEmpty) super.positionInUltimateSource(position) + if (!position.isDefined) super.positionInUltimateSource(position) else { println("!!!") - var off = position.offset.get + var off = position.point var compsLeft = components // the search here has to be against the length of the files underlying the // components, not their advertised length (which in the case of a fragment is @@ -249,12 +249,9 @@ extends BatchSourceFile(name, contents) { start, stop) - override def positionInUltimateSource(position: Position) = { - if (position.offset.isEmpty) - super.positionInUltimateSource(position) - else { - super.positionInUltimateSource( - new OffsetPosition(this, position.offset.get)) - } - } + override def positionInUltimateSource(position: Position) = + super.positionInUltimateSource( + if (position.isDefined) new OffsetPosition(this, position.point) + else position + ) } -- cgit v1.2.3