mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 05:41:14 +01:00
Upgrade to the latest source_span. (#151)
This commit is contained in:
parent
e032de83fb
commit
ab48b7104d
@ -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(
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user