From eec72c46f2f63f682c80a8c6afe428e5dc470b30 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Wed, 1 Feb 2017 11:38:18 +0100 Subject: [PATCH] avoid using macro-based StringContext.f to ease bootstrap --- .../dotty/tools/dotc/core/tasty/TastyPrinter.scala | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala index 0dc8d8feadcd..fb37c9e7d124 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyPrinter.scala @@ -31,8 +31,10 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) { def nameRefToString(ref: NameRef): String = nameToString(tastyName(ref)) def printNames() = - for ((name, idx) <- tastyName.contents.zipWithIndex) - println(f"$idx%4d: " + nameToString(name)) + for ((name, idx) <- tastyName.contents.zipWithIndex) { + val index = "%4d: ".format(idx) + println(index + nameToString(name)) + } def printContents(): Unit = { println("Names:") @@ -47,7 +49,10 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) { def unpickle(reader: TastyReader, tastyName: TastyName.Table): Unit = { import reader._ var indent = 0 - def newLine() = print(f"\n ${index(currentAddr) - index(startAddr)}%5d:" + " " * indent) + def newLine() = { + val length = "%5d:".format(index(currentAddr) - index(startAddr)) + print(s"\n $length" + " " * indent) + } def printNat() = print(" " + readNat()) def printName() = { val idx = readNat()