Skip to content

Commit fc2e654

Browse files
committed
Address more review comments
1 parent 570b26f commit fc2e654

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Standard Section: "Positions" Assoc*
229229
// same offset in the previously recorded node (or 0 for the first recorded node)
230230
Delta = Int // Difference between consecutive offsets,
231231
SOURCE = 4 // Impossible as header, since addr_Delta = 0 implies that we refer to the
232-
// same treeas the previous one, but then hasStartDiff = 1 implies that
232+
// same tree as the previous one, but then hasStartDiff = 1 implies that
233233
// the tree's range starts later than the range of itself.
234234
235235
All elements of a position section are serialized as Ints

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,17 @@ object Inliner {
130130
* Any tree directly inside an empty call (inlined in the inlined code) retains their position.
131131
*/
132132
class Reposition extends TreeMap {
133-
override def transform(tree: Tree)(implicit ctx: Context): Tree = {
134-
if (tree.source != ctx.source && tree.source.exists)
135-
transform(tree)(ctx.withSource(tree.source))
136-
else tree match {
137-
case tree: Inlined => transformInline(tree)
138-
case _ =>
139-
val transformed = super.transform(tree)
140-
enclosingInlineds match {
141-
case call :: _ if call.symbol.source != curSource =>
142-
// Until we implement JSR-45, we cannot represent in output positions in other source files.
143-
// So, reposition inlined code from other files with the call position:
144-
transformed.withSpan(inlined.call.span)
145-
case _ => transformed
146-
}
147-
}
133+
override def transform(tree: Tree)(implicit ctx: Context): Tree = tree match {
134+
case tree: Inlined => transformInline(tree)
135+
case _ =>
136+
val transformed = super.transform(tree)
137+
enclosingInlineds match {
138+
case call :: _ if call.symbol.source != curSource =>
139+
// Until we implement JSR-45, we cannot represent in output positions in other source files.
140+
// So, reposition inlined code from other files with the call position:
141+
transformed.withSpan(inlined.call.span)
142+
case _ => transformed
143+
}
148144
}
149145
def transformInline(tree: Inlined)(implicit ctx: Context): Tree = {
150146
tpd.seq(transformSub(tree.bindings), transform(tree.expansion)(inlineContext(tree.call)))

0 commit comments

Comments
 (0)