Fix blank lists in property values.

This commit is contained in:
Natalie Weizenbaum 2016-10-18 21:45:25 -07:00
parent 870a2a4f4a
commit c44481ba29

View File

@ -245,7 +245,7 @@ class _PerformVisitor implements StatementVisitor, ExpressionVisitor<Value> {
// If the value is an empty list, preserve it, because converting it to CSS // If the value is an empty list, preserve it, because converting it to CSS
// will throw an error that we want the user to see. // will throw an error that we want the user to see.
if (cssValue != null && if (cssValue != null &&
(!cssValue.value.isBlank || cssValue.value is SassList)) { (!cssValue.value.isBlank || _isEmptyList(cssValue.value))) {
_parent.addChild(new CssDeclaration(name, cssValue, node.span)); _parent.addChild(new CssDeclaration(name, cssValue, node.span));
} }
@ -259,6 +259,9 @@ class _PerformVisitor implements StatementVisitor, ExpressionVisitor<Value> {
} }
} }
/// Returns whether [value] is an empty [SassList].
bool _isEmptyList(Value value) => value is List && value.contents.isEmpty;
Value visitEachRule(EachRule node) { Value visitEachRule(EachRule node) {
var list = node.list.accept(this); var list = node.list.accept(this);
var setVariables = node.variables.length == 1 var setVariables = node.variables.length == 1