Merge pull request #117 from sass/fixes

Fix more bugs.
This commit is contained in:
Natalie Weizenbaum 2017-02-08 14:25:24 -08:00 committed by GitHub
commit 18f4c1b801
2 changed files with 15 additions and 10 deletions

View File

@ -75,6 +75,11 @@
* Fix an `@extend` edge case involving multiple combinators in a row.
* Fix a bug where a `@content` block could get incorrectly passed to a mixin.
* Properly isolate the lexical environments of different calls to the same mixin
and function.
## 1.0.0-alpha.8
* Add the `content-exists()` function.

View File

@ -364,7 +364,9 @@ class _PerformVisitor
if (block == null) return null;
_withStackFrame("@content", node.span, () {
_withEnvironment(_environment.contentEnvironment, () {
// Add an extra closure() call so that modifications to the environment
// don't affect the underlying environment closure.
_withEnvironment(_environment.contentEnvironment.closure(), () {
for (var statement in block) {
statement.accept(this);
}
@ -714,14 +716,10 @@ class _PerformVisitor
return null;
}
if (node.children == null) {
_runUserDefinedCallable(node.arguments, mixin, node.span, callback);
} else {
var environment = _environment.closure();
_runUserDefinedCallable(node.arguments, mixin, node.span, () {
_environment.withContent(node.children, environment, callback);
});
}
var environment = node.children == null ? null : _environment.closure();
_runUserDefinedCallable(node.arguments, mixin, node.span, () {
_environment.withContent(node.children, environment, callback);
});
return null;
}
@ -1122,7 +1120,9 @@ class _PerformVisitor
var separator = triple.item3;
return _withStackFrame(callable.name + "()", span, () {
return _withEnvironment(callable.environment, () {
// Add an extra closure() call so that modifications to the environment
// don't affect the underlying environment closure.
return _withEnvironment(callable.environment.closure(), () {
return _environment.scope(() {
_verifyArguments(
positional.length, named, callable.declaration.arguments, span);