SourceRange.fromOffset constructor
Create from offset and length with line info.
Implementation
factory SourceRange.fromOffset(int offset, int length, LineInfo lineInfo) {
final startLocation = lineInfo.getLocation(offset);
final endLocation = lineInfo.getLocation(offset + length);
return SourceRange(
start: SourcePosition(
line: startLocation.lineNumber,
column: startLocation.columnNumber,
),
end: SourcePosition(
line: endLocation.lineNumber,
column: endLocation.columnNumber,
),
offset: offset,
length: length,
);
}