Dotty Documentation


abstract class Positioned
extends DotClass with Product

A base class for things that have positions (currently: modifiers and trees)

[-] Constructors

Positioned ( )

[-] Members

[+] private var curPos : Position
[+] def addPos ( pos: Position ) : Positioned

This item with a position that's the union of the given pos and the current position.

[+] def checkPos ( nonOverlapping: Boolean ) ( implicit ctx: Context ) : Unit

Check that all positioned items in this tree satisfy the following conditions: - Parent positions contain child positions - If item is a non-empty tree, it has a position

[+] def contains ( that: Positioned ) : Boolean
[+] def initialPos : Position

The initial, synthetic position. This is usually the union of all positioned children's positions.

[+] def pos : Position

The item's position.

[+] private def setChildPositions ( pos: Position ) : Unit

If any children of this node do not have positions, fit their positions between the positions of the known subtrees and transitively visit their children. The method is likely time-critical because it is invoked on any node we create, so we want to avoid object allocations in the common case. The method is naturally expressed as two mutually (tail-)recursive functions, one which computes the next element to consider or terminates if there is none and the other which propagates the position information to that element. But since mutual tail recursion is not supported in Scala, we express it instead as a while loop with a termination by return in the middle.

[+] protected def setPos ( pos: Position ) : Unit

Destructively update curPos to given position. Also, set any missing positions in children.

[+] def setPosUnchecked ( pos: Position ) : Unit

Set position of this tree only, without performing any checks of consistency with - or updates of - other positions. Called from Unpickler when entering positions.

[+] private def unionPos ( pos: Position , xs: List [ Nothing <: Any ] ) : Position
[+] def withPos ( pos: Position ) : Positioned

A positioned item like this one with the position set to pos. if the positioned item is source-derived, a clone is returned. If the positioned item is synthetic, the position is updated destructively and the item itself is returned.

[+] def withPos ( posd: Positioned ) : Positioned