A base class for things that have positions (currently: modifiers and trees)
This item with a position that's the union of the given
pos and the
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
The initial, synthetic position. This is usually the union of all positioned children's positions.
The item's position.
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.
curPos to given position. Also, set any missing
positions in children.
Set position of this tree only, without performing any checks of consistency with - or updates of - other positions. Called from Unpickler when entering positions.
A positioned item like this one with the position set to
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.