SourceLocation constructor
Creates a new location indicating offset
within sourceUrl
.
line
and column
default to assuming the source is a single line. This
means that line
defaults to 0 and column
defaults to offset
.
Implementation
SourceLocation(int offset, {sourceUrl, int line, int column})
: sourceUrl = sourceUrl is String ? Uri.parse(sourceUrl) : sourceUrl,
offset = offset,
line = line == null ? 0 : line,
column = column == null ? offset : column {
if (offset < 0) {
throw new RangeError("Offset may not be negative, was $offset.");
} else if (line != null && line < 0) {
throw new RangeError("Line may not be negative, was $line.");
} else if (column != null && column < 0) {
throw new RangeError("Column may not be negative, was $column.");
}
}