Skip to content

Commit 107fdb7

Browse files
committed
Polishings
1 parent c7dc93d commit 107fdb7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

compiler/src/dotty/tools/dotc/ast/Positioned.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ abstract class Positioned(implicit @transientParam src: SourceInfo) extends Prod
4040
//assert(id != 2067, getClass)
4141
}
4242

43-
/** Destructively update `mySpan` to given span. Also, set any missing
44-
* spans in children.
43+
/** Destructively update `mySpan` to given span and potentially update `id` so that
44+
* it refers to `file`. Also, set any missing positions in children.
4545
*/
4646
protected def setPos(span: Span, file: AbstractFile): Unit = {
47-
setOneSpan(span, file)
48-
if (span.exists) setChildSpans(span.toSynthetic, file)
47+
setOnePos(span, file)
48+
if (span.exists) setChildPositions(span.toSynthetic, file)
4949
}
5050

5151
/** A positioned item like this one with given `span`.
@@ -82,7 +82,7 @@ abstract class Positioned(implicit @transientParam src: SourceInfo) extends Prod
8282
/** Set span of this tree only, without updating children spans.
8383
* Called from Unpickler when entering positions.
8484
*/
85-
private[dotc] def setOneSpan(span: Span, file: AbstractFile = this.srcfile): Unit = {
85+
private[dotc] def setOnePos(span: Span, file: AbstractFile = this.srcfile): Unit = {
8686
if (file != this.srcfile) setId(TreeIds.nextIdFor(file))
8787
mySpan = span
8888
}
@@ -98,7 +98,7 @@ abstract class Positioned(implicit @transientParam src: SourceInfo) extends Prod
9898
* But since mutual tail recursion is not supported in Scala, we express it instead
9999
* as a while loop with a termination by return in the middle.
100100
*/
101-
private def setChildSpans(span: Span, file: AbstractFile): Unit = {
101+
private def setChildPositions(span: Span, file: AbstractFile): Unit = {
102102
var n = productArity // subnodes are analyzed right to left
103103
var elems: List[Any] = Nil // children in lists still to be considered, from right to left
104104
var end = span.end // the last defined offset, fill in spans up to this offset

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ class TreeUnpickler(reader: TastyReader,
13351335
/** Set position of `tree` at given `addr`. */
13361336
def setPos[T <: untpd.Tree](addr: Addr, tree: T)(implicit ctx: Context): tree.type = {
13371337
val pos = posAt(addr)
1338-
if (pos.exists) tree.setOneSpan(pos, ctx.source.file)
1338+
if (pos.exists) tree.setOnePos(pos, ctx.source.file)
13391339
tree
13401340
}
13411341
}

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ object Parsers {
8181
* to position spanning from `start` to last read offset, with given point.
8282
* If the last offset is less than or equal to start, the tree `t` did not
8383
* consume any source for its construction. In this case, don't position it yet,
84-
* but wait for its position to be determined by `setChildSpans` when the
84+
* but wait for its position to be determined by `setChildPositions` when the
8585
* parent node is positioned.
8686
*/
8787
def atPos[T <: Positioned](start: Offset, point: Offset)(t: T): T =

0 commit comments

Comments
 (0)