SourceSpan class final

A half-open range [start, end) of UTF-16 offsets into the parsed source.

Offsets are into the normalized source (SourceText.text); use SourceText.originalSpan to map back to the caller's string.

Constructors

SourceSpan(int start, int end)
Creates a span from start (inclusive) to end (exclusive).
const
SourceSpan.between(int a, int b)
The span between two offsets in either order. Tokens produced by macros carry the macro call's span, so an opening token can sit after its closing one.
factory
SourceSpan.empty(int offset)
An empty span at offset.
const

Properties

end → int
One past the last code unit covered.
final
hashCode → int
The hash code for this object.
no setteroverride
isEmpty → bool
Whether the span covers nothing.
no setter
length → int
Number of code units covered.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
start → int
First code unit covered.
final

Methods

contains(int offset) → bool
Whether offset lies inside this span.
cover(SourceSpan other) → SourceSpan
The smallest span covering both this and other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
textOf(String source) → String
The covered text of source.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override