ReadonlyrawThe underlying tuple; use it whenever you need the plain representation back.
the inclusive end as a SourcePosition
inclusive column the location ends at
inclusive line the location ends on
the file the location refers to, undefined for a plain SourceRange
the SourceRange part, file excluded
the inclusive start as a SourcePosition
inclusive column the location starts at (starts with 1)
inclusive line the location starts on (starts with 1)
Destructuring a view yields the same elements as destructuring the tuple.
Whether the given position lies within this location; omitting the column checks the line alone.
Optionalcolumn: numberWhether other lies completely within this location, files ignored.
The smallest location covering this one and all others, undefined if they are not in the same file.
The same location, but attributed to the given file.
An object-oriented read-only view on a SourceLocation (and hence on a SourceRange).
The view holds a reference to the tuple it was created from and copies nothing, so it costs one small object and every accessor is a plain tuple read. Serializing it yields the very tuple again, so a view may be handed to
JSON.stringifyin place of the location.Tuples remain the representation that is stored and sent over the wire; create a view where you read a location and drop it afterwards rather than keeping one per node.
Example