summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala25
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
}