SourceSpanWithContext constructor
Creates a new span from start to end (exclusive) containing text, in
the given context.
start and end must have the same source URL and start must come
before end. text must have a number of characters equal to the
distance between start and end. context must contain text, and
text should start at start.column from the beginning of a line in
context.
Implementation
SourceSpanWithContext(
SourceLocation start, SourceLocation end, String text, this._context)
: super(start, end, text) {
if (!context.contains(text)) {
throw new ArgumentError(
'The context line "$context" must contain "$text".');
}
if (findLineStart(context, text, start.column) == null) {
throw new ArgumentError('The span text "$text" must start at '
'column ${start.column + 1} in a line within "$context".');
}
}