diff options
Diffstat (limited to 'src/compiler/scala/tools/reflect/MacroImplementations.scala')
-rw-r--r-- | src/compiler/scala/tools/reflect/MacroImplementations.scala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/reflect/MacroImplementations.scala b/src/compiler/scala/tools/reflect/MacroImplementations.scala index f4f385f8b3..a9ed419b1e 100644 --- a/src/compiler/scala/tools/reflect/MacroImplementations.scala +++ b/src/compiler/scala/tools/reflect/MacroImplementations.scala @@ -1,10 +1,9 @@ package scala.tools.reflect -import scala.reflect.macros.{ReificationException, UnexpectedReificationException} -import scala.reflect.macros.runtime.Context +import scala.reflect.macros.contexts.Context import scala.collection.mutable.ListBuffer import scala.collection.mutable.Stack -import scala.reflect.internal.util.OffsetPosition +import scala.reflect.internal.util.Position abstract class MacroImplementations { val c: Context @@ -35,7 +34,7 @@ abstract class MacroImplementations { val argStack = Stack(args : _*) def defval(value: Tree, tpe: Type): Unit = { - val freshName = newTermName(c.fresh("arg$")) + val freshName = newTermName(c.freshName("arg$")) evals += ValDef(Modifiers(), freshName, TypeTree(tpe) setPos value.pos.focus, value) setPos value.pos ids += Ident(freshName) } @@ -92,10 +91,11 @@ abstract class MacroImplementations { def isConversion(idx: Int) = isPercent(idx) && !charAtIndexIs(idx + 1, 'n') && !charAtIndexIs(idx + 1, '%') var idx = 0 - def errorAtIndex(idx: Int, msg: String) = c.error(new OffsetPosition(strTree.pos.source, strTree.pos.point + idx), msg) + def errorAtIndex(idx: Int, msg: String) = c.error(Position.offset(strTree.pos.source, strTree.pos.point + idx), msg) def wrongConversionString(idx: Int) = errorAtIndex(idx, "wrong conversion string") def illegalConversionCharacter(idx: Int) = errorAtIndex(idx, "illegal conversion character") - def nonEscapedPercent(idx: Int) = errorAtIndex(idx, "percent signs not directly following splicees must be escaped") + def nonEscapedPercent(idx: Int) = errorAtIndex(idx, + "conversions must follow a splice; use %% for literal %, %n for newline") // STEP 1: handle argument conversion // 1) "...${smth}" => okay, equivalent to "...${smth}%s" @@ -106,7 +106,7 @@ abstract class MacroImplementations { // 6) "...${smth}[%legalJavaConversion]" => okay, according to http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html // 7) "...${smth}[%illegalJavaConversion]" => error if (!first) { - val arg = argStack.pop + val arg = argStack.pop() if (isConversion(0)) { // PRE str is not empty and str(0) == '%' // argument index parameter is not allowed, thus parse @@ -163,9 +163,9 @@ abstract class MacroImplementations { Literal(Constant(fstring)), newTermName("format")), List(ids: _* ) - ); + ) Block(evals.toList, atPos(origApplyPos.focus)(expr)) setPos origApplyPos.makeTransparent } -}
\ No newline at end of file +} |