diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-06-24 15:19:05 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-06-24 18:10:42 +1000 |
commit | 1f7417c763fb199cacc6afedc6e54796916fd673 (patch) | |
tree | bd00d7e0e47be310172f01c758c01ca5430063c4 /src/compiler/scala/tools/nsc/Global.scala | |
parent | 73f40564a6b19e8b15f0908c3e24f1a8fe405605 (diff) | |
parent | 1b09e12ef3b3fea1cab56bac893295f74de23b8b (diff) | |
download | scala-1f7417c763fb199cacc6afedc6e54796916fd673.tar.gz scala-1f7417c763fb199cacc6afedc6e54796916fd673.tar.bz2 scala-1f7417c763fb199cacc6afedc6e54796916fd673.zip |
Merge branch '2.11.x' into merge/2.11.x-to-2.12.x-20150624
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 72e96df37c..778f2fed59 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -10,7 +10,6 @@ package nsc import java.io.{ File, FileOutputStream, PrintWriter, IOException, FileNotFoundException } import java.net.URL import java.nio.charset.{ Charset, CharsetDecoder, IllegalCharsetNameException, UnsupportedCharsetException } -import scala.compat.Platform.currentTime import scala.collection.{ mutable, immutable } import io.{ SourceReader, AbstractFile, Path } import reporters.{ Reporter, ConsoleReporter } @@ -1490,6 +1489,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) compileUnitsInternal(units, fromPhase) private def compileUnitsInternal(units: List[CompilationUnit], fromPhase: Phase) { + def currentTime = java.util.concurrent.TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) + units foreach addUnit val startTime = currentTime @@ -1677,23 +1678,25 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def getFile(clazz: Symbol, suffix: String): File = getFile(clazz.sourceFile, clazz.fullName split '.', suffix) private def writeICode() { - val printer = new icodes.TextPrinter(null, icodes.linearizer) - icodes.classes.values.foreach((cls) => { - val moduleSfx = if (cls.symbol.hasModuleFlag) "$" else "" - val phaseSfx = if (settings.debug) phase else "" // only for debugging, appending the full phasename breaks windows build - val file = getFile(cls.symbol, s"$moduleSfx$phaseSfx.icode") + val printer = new icodes.TextPrinter(writer = null, icodes.linearizer) + icodes.classes.values foreach { cls => + val file = { + val module = if (cls.symbol.hasModuleFlag) "$" else "" + val faze = if (settings.debug) phase.name else f"${phase.id}%02d" // avoid breaking windows build with long filename + getFile(cls.symbol, s"$module-$faze.icode") + } try { val stream = new FileOutputStream(file) printer.setWriter(new PrintWriter(stream, true)) printer.printClass(cls) - informProgress("wrote " + file) + informProgress(s"wrote $file") } catch { - case ex: IOException => - if (settings.debug) ex.printStackTrace() - globalError("could not write file " + file) + case e: IOException => + if (settings.debug) e.printStackTrace() + globalError(s"could not write file $file") } - }) + } } def createJavadoc = false } |