Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to the latest source_span. #151

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/io/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ String readFile(String path) {
var contents = _readFile(path, 'utf8') as String;
if (!contents.contains("�")) 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(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/io/vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions lib/src/visitor/perform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down