Skip to content

Commit d69f680

Browse files
committed
Extract condintion
1 parent 69cf220 commit d69f680

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/transform/YCheckPositions.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ class YCheckPositions extends Phases.Phase {
4545
case Inlined(call, bindings, expansion) =>
4646
bindings.foreach(traverse(_))
4747
sources = call.symbol.topLevelClass.source :: sources
48-
if (
49-
!( // FIXME macro implementations can drop Inlined nodes. We should reinsert them after macro expansion based on the positions of the trees
50-
((ctx.phase <= ctx.typerPhase.next) && call.symbol.is(Macro)) ||
51-
(!(ctx.phase <= ctx.typerPhase.next) && call.symbol.unforcedDecls.exists(_.is(Macro)) || call.symbol.unforcedDecls.toList.exists(_.is(Macro)))
52-
)
53-
) traverse(expansion)(inlineContext(call))
48+
if (!isMacro(call)) // FIXME macro implementations can drop Inlined nodes. We should reinsert them after macro expansion based on the positions of the trees
49+
traverse(expansion)(inlineContext(call))
5450
sources = sources.tail
5551
case _ => traverseChildren(tree)
5652
}
5753
}
5854
}.traverse(tree)
5955
case _ =>
6056
}
57+
}
6158

59+
private def isMacro(call: Tree)(implicit ctx: Context) = {
60+
((ctx.phase <= ctx.typerPhase.next) && call.symbol.is(Macro)) ||
61+
(!(ctx.phase <= ctx.typerPhase.next) && call.symbol.unforcedDecls.exists(_.is(Macro)) || call.symbol.unforcedDecls.toList.exists(_.is(Macro)))
6262
}
6363

6464
}

0 commit comments

Comments
 (0)