From c78081090ef2fddcb013c908b3a986d2769a9fe2 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 11 Jul 2013 15:34:21 +1000 Subject: Comply with range position checking. - Make sure all trees are positioned - Mark range positions for synthetic code as transparent to allow some wiggle room for overlapping ranges. Enables -Yrangepos for our test suite. We can't add it for the entire build until the fix for SI-7649 lands in the compiler. --- src/main/scala/scala/async/internal/AsyncTransform.scala | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main/scala/scala/async/internal/AsyncTransform.scala') diff --git a/src/main/scala/scala/async/internal/AsyncTransform.scala b/src/main/scala/scala/async/internal/AsyncTransform.scala index bdc8664..c755c87 100644 --- a/src/main/scala/scala/async/internal/AsyncTransform.scala +++ b/src/main/scala/scala/async/internal/AsyncTransform.scala @@ -41,7 +41,7 @@ trait AsyncTransform { Template(List(stateMachineType), emptyValDef, body) } val t = ClassDef(NoMods, name.stateMachineT, Nil, template) - callSiteTyper.typedPos(macroApplication.pos)(Block(t :: Nil, Literal(Constant(())))) + callSiteTyper.typedPos(macroPos)(Block(t :: Nil, Literal(Constant(())))) t } @@ -56,8 +56,8 @@ trait AsyncTransform { val stateMachineSpliced: Tree = spliceMethodBodies( liftables(asyncBlock.asyncStates), stateMachine, - asyncBlock.onCompleteHandler[T], - asyncBlock.resumeFunTree[T].rhs + atMacroPos(asyncBlock.onCompleteHandler[T]), + atMacroPos(asyncBlock.resumeFunTree[T].rhs) ) def selectStateMachine(selection: TermName) = Select(Ident(name.stateMachine), selection) @@ -78,12 +78,11 @@ trait AsyncTransform { } def logDiagnostics(anfTree: Tree, states: Seq[String]) { - val pos = macroApplication.pos def location = try { - pos.source.path + macroPos.source.path } catch { case _: UnsupportedOperationException => - pos.toString + macroPos.toString } AsyncUtils.vprintln(s"In file '$location':") @@ -124,7 +123,9 @@ trait AsyncTransform { EmptyTree case Ident(name) if liftedSyms(tree.symbol) => val fieldSym = tree.symbol - gen.mkAttributedStableRef(fieldSym.owner.thisType, fieldSym).setType(tree.tpe) + atPos(tree.pos) { + gen.mkAttributedStableRef(fieldSym.owner.thisType, fieldSym).setType(tree.tpe) + } case _ => super.transform(tree) } -- cgit v1.2.3