mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Fix printing of childless at-rules.
This commit is contained in:
parent
0498e8a95c
commit
64c2453a35
@ -13,13 +13,21 @@ class CssAtRule extends CssParentNode {
|
||||
|
||||
final CssValue<String> value;
|
||||
|
||||
final bool isChildless;
|
||||
|
||||
final FileSpan span;
|
||||
|
||||
CssAtRule(this.name, {this.value, this.span});
|
||||
CssAtRule(this.name, {bool childless: false, this.value, this.span})
|
||||
: isChildless = childless;
|
||||
|
||||
/*=T*/ accept/*<T>*/(CssVisitor/*<T>*/ visitor) =>
|
||||
visitor.visitAtRule(this);
|
||||
|
||||
void addChild(CssNode child) {
|
||||
assert(!isChildless);
|
||||
super.addChild(child);
|
||||
}
|
||||
|
||||
String toString() {
|
||||
var buffer = new StringBuffer("@$name");
|
||||
if (value != null) buffer.write(" $value");
|
||||
|
@ -101,7 +101,9 @@ class PerformVisitor extends StatementVisitor
|
||||
: _interpolationToValue(node.value, trim: true);
|
||||
|
||||
if (node.children == null) {
|
||||
_parent.addChild(new CssAtRule(node.name, value: value, span: node.span));
|
||||
_parent.addChild(new CssAtRule(node.name,
|
||||
childless: true, value: value, span: node.span));
|
||||
return;
|
||||
}
|
||||
|
||||
_withParent(new CssAtRule(node.name, value: value, span: node.span), () {
|
||||
|
@ -75,7 +75,7 @@ class _SerializeCssVisitor extends CssVisitor {
|
||||
_buffer.write(node.value.value);
|
||||
}
|
||||
|
||||
if (node.children == null) {
|
||||
if (node.isChildless) {
|
||||
_buffer.writeCharCode($semicolon);
|
||||
} else {
|
||||
_buffer.writeCharCode($space);
|
||||
|
Loading…
Reference in New Issue
Block a user