Fix an edge-case bug

If a non-partial stylesheet is next to a partial with the same name,
canonicalizing the source URL would fail. We don't really need to
canonicalize that URL anyway, though, since it's only used for import
loops and such a loop will reload and rerun the entrypoint anyway.
This commit is contained in:
Natalie Weizenbaum 2018-06-06 16:00:58 -04:00
parent 0a21fb7063
commit 594f936c54
4 changed files with 19 additions and 7 deletions

View File

@ -2,6 +2,9 @@
* Produce better errors when expected tokens are missing before a closing brace.
* Avoid crashing when compiling a non-partial stylesheet that exists on the
filesystem next to a partial with the same name.
### Command-Line Interface
* When using `--update`, surface errors when an import doesn't exist even if the

View File

@ -309,9 +309,6 @@ class _EvaluateVisitor
_includedFiles.add(_baseUrl.toString());
}
}
var canonicalUrl = await _importer?.canonicalize(_baseUrl);
if (canonicalUrl != null) _activeImports.add(canonicalUrl);
}
await visitStylesheet(node);

View File

@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/synchronize.dart for details.
//
// Checksum: bb333ed7c02c663af1977b3eb6c666b7bed92c1a
// Checksum: dff931bdeda830c46fb13eac40e1d783f86c7aec
import 'async_evaluate.dart' show EvaluateResult;
export 'async_evaluate.dart' show EvaluateResult;
@ -314,9 +314,6 @@ class _EvaluateVisitor
_includedFiles.add(_baseUrl.toString());
}
}
var canonicalUrl = _importer?.canonicalize(_baseUrl);
if (canonicalUrl != null) _activeImports.add(canonicalUrl);
}
visitStylesheet(node);

View File

@ -194,6 +194,21 @@ void sharedTests(Future<TestProcess> runSass(Iterable<String> arguments)) {
await sass.shouldExit(65);
});
test("gracefully handles a non-partial next to a partial", () async {
await d.file("test.scss", "a {b: c}").create();
await d.file("_test.scss", "x {y: z}").create();
var sass = await runSass(["test.scss"]);
expect(
sass.stdout,
emitsInOrder([
"a {",
" b: c;",
"}",
]));
await sass.shouldExit(0);
});
test("emits warnings on standard error", () async {
await d.file("test.scss", "@warn 'aw beans'").create();