Upgrade to the latest source_span. (#151)

This commit is contained in:
Natalie Weizenbaum 2017-06-05 12:35:30 -07:00 committed by GitHub
parent e032de83fb
commit ab48b7104d
4 changed files with 6 additions and 5 deletions

View File

@ -60,7 +60,7 @@ String readFile(String path) {
var contents = _readFile(path, 'utf8') as String;
if (!contents.contains("<EFBFBD>")) return contents;
var sourceFile = new SourceFile(contents, url: p.toUri(path));
var sourceFile = new SourceFile.fromString(contents, url: p.toUri(path));
for (var i = 0; i < contents.length; i++) {
if (contents.codeUnitAt(i) != 0xFFFD) continue;
throw new SassException(

View File

@ -23,7 +23,7 @@ String readFile(String path) {
return UTF8.decode(bytes);
} on FormatException {
var decoded = UTF8.decode(bytes, allowMalformed: true);
var sourceFile = new SourceFile(decoded, url: p.toUri(path));
var sourceFile = new SourceFile.fromString(decoded, url: p.toUri(path));
// TODO(nweiz): Use [FormatException.offset] instead when
// dart-lang/sdk#28293 is fixed.

View File

@ -1643,8 +1643,9 @@ class _PerformVisitor
var syntheticFile = span.file
.getText(0)
.replaceRange(span.start.offset, span.end.offset, errorText);
var syntheticSpan = new SourceFile(syntheticFile, url: span.file.url)
.span(span.start.offset + error.span.start.offset,
var syntheticSpan =
new SourceFile.fromString(syntheticFile, url: span.file.url).span(
span.start.offset + error.span.start.offset,
span.start.offset + error.span.end.offset);
throw _exception(error.message, syntheticSpan);
}

View File

@ -15,7 +15,7 @@ dependencies:
charcode: "^1.1.0"
collection: "^1.8.0"
path: "^1.0.0"
source_span: "^1.3.0"
source_span: "^1.4.0"
string_scanner: ">=0.1.5 <2.0.0"
stack_trace: ">=0.9.0 <2.0.0"
tuple: "^1.0.0"