diff options
author | James Iry <james.iry@typesafe.com> | 2012-12-03 09:23:59 -0800 |
---|---|---|
committer | James Iry <james.iry@typesafe.com> | 2012-12-07 10:28:29 -0800 |
commit | 593a7605d4a157ff59700741542a3581025f67e7 (patch) | |
tree | f87a3c4b7d1d2b59ce820d3c480b0363523e2df0 /src/compiler/scala/tools | |
parent | b1cb6578bdbdfaa66d3cf09f40dfc1511f7e9711 (diff) | |
download | scala-593a7605d4a157ff59700741542a3581025f67e7.tar.gz scala-593a7605d4a157ff59700741542a3581025f67e7.tar.bz2 scala-593a7605d4a157ff59700741542a3581025f67e7.zip |
Small cleanup work done during my initial visits to the code.
These are just a series of small cleanups I did while reading
the code base during my first few days. None are actual
functionality bugs and none warrant a full blown bug. Now
that I'm moving on to doing real work small stuff like this will
likely be swept up in other bugs, so this commit just captures
that initial pass of stuff.
Diffstat (limited to 'src/compiler/scala/tools')
4 files changed, 12 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index f79990d526..e4c250a3d9 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -56,9 +56,6 @@ class StandardCompileServer extends SocketServer { (totalMemory - freeMemory).toDouble / maxMemory.toDouble > MaxCharge } - protected def newOfflineCompilerCommand(arguments: List[String], settings: FscSettings): OfflineCompilerCommand = - new OfflineCompilerCommand(arguments, settings) - /** Problematically, Settings are only considered equal if every setting * is exactly equal. In fsc this immediately breaks down because the randomly * chosen temporary outdirs differ between client and server. Among other @@ -91,7 +88,7 @@ class StandardCompileServer extends SocketServer { val args = input.split("\0", -1).toList val newSettings = new FscSettings(fscError) this.verbose = newSettings.verbose.value - val command = newOfflineCompilerCommand(args, newSettings) + val command = new OfflineCompilerCommand(args, newSettings) info("Settings after normalizing paths: " + newSettings) printMemoryStats() diff --git a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala index 8a3c531ff0..2f4975e681 100644 --- a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala @@ -26,8 +26,8 @@ class OfflineCompilerCommand(arguments: List[String], settings: FscSettings) ext // instead of whatever it's supposed to be doing. val baseDirectory = { val pwd = System.getenv("PWD") - if (pwd != null && !isWin) Directory(pwd) - else Directory.Current getOrElse Directory("/") + if (pwd == null || isWin) Directory.Current getOrElse Directory("/") + else Directory(pwd) } currentDir.value = baseDirectory.path } diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index f78a5133a6..ca69d52798 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -381,20 +381,20 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { if (clazz.isImplClass) { clazz setFlag lateMODULE var sourceModule = clazz.owner.info.decls.lookup(sym.name.toTermName) - if (sourceModule != NoSymbol) { - sourceModule setPos sym.pos - if (sourceModule.flags != MODULE) { - log("!!! Directly setting sourceModule flags from %s to MODULE".format(sourceModule.flagString)) - sourceModule.flags = MODULE - } - } - else { + if (sourceModule == NoSymbol) { sourceModule = ( clazz.owner.newModuleSymbol(sym.name.toTermName, sym.pos, MODULE) setModuleClass sym.asInstanceOf[ClassSymbol] ) clazz.owner.info.decls enter sourceModule } + else { + sourceModule setPos sym.pos + if (sourceModule.flags != MODULE) { + log("!!! Directly setting sourceModule flags from %s to MODULE".format(sourceModule.flagString)) + sourceModule.flags = MODULE + } + } sourceModule setInfo sym.tpe // Companion module isn't visible for anonymous class at this point anyway assert(clazz.sourceModule != NoSymbol || clazz.isAnonymousClass, diff --git a/src/compiler/scala/tools/nsc/util/SimpleTracer.scala b/src/compiler/scala/tools/nsc/util/SimpleTracer.scala index a33af1754d..6997dbd402 100644 --- a/src/compiler/scala/tools/nsc/util/SimpleTracer.scala +++ b/src/compiler/scala/tools/nsc/util/SimpleTracer.scala @@ -6,7 +6,7 @@ package util import java.io.PrintStream /** A simple tracer - * @param out: The print stream where trace info shoul be sent + * @param out: The print stream where trace info should be sent * @param enabled: A condition that must be true for trace info to be produced. */ class SimpleTracer(out: PrintStream, enabled: Boolean = true) { |