Implement CssNode.toString() using toCss().

This commit is contained in:
Natalie Weizenbaum 2016-09-03 01:08:55 -07:00 committed by Natalie Weizenbaum
parent e607e7914f
commit cc56ea0f13
7 changed files with 3 additions and 22 deletions

View File

@ -15,6 +15,4 @@ class CssComment extends CssNode {
CssComment(this.text, this.span);
/*=T*/ accept/*<T>*/(CssVisitor/*<T>*/ visitor) => visitor.visitComment(this);
String toString() => text;
}

View File

@ -22,6 +22,4 @@ class CssDeclaration extends CssNode {
/*=T*/ accept/*<T>*/(CssVisitor/*<T>*/ visitor) =>
visitor.visitDeclaration(this);
String toString() => "$name: $value;";
}

View File

@ -72,16 +72,4 @@ class CssMediaQuery implements AstNode {
modifier: modifier == ourModifier ? this.modifier : other.modifier,
features: features.toList()..addAll(other.features));
}
String toString() {
var buffer = new StringBuffer();
if (modifier != null) buffer.write("$modifier ");
if (type != null) {
buffer.write(type);
if (features.isNotEmpty) buffer.write(" and ");
}
buffer.write(features.join(" and "));
return buffer.toString();
}
}

View File

@ -5,6 +5,7 @@
import 'dart:collection';
import '../../visitor/interface/css.dart';
import '../../visitor/serialize.dart';
import '../node.dart';
abstract class CssNode extends AstNode {
@ -25,6 +26,8 @@ abstract class CssNode extends AstNode {
_parent._children[i]._indexInParent--;
}
}
String toString() => toCss(this);
}
// New at-rule implementations should add themselves to at-root's exclude logic.

View File

@ -20,6 +20,4 @@ class CssStyleRule extends CssParentNode {
visitor.visitStyleRule(this);
CssStyleRule copyWithoutChildren() => new CssStyleRule(selector, span);
String toString() => "$selector {${children.join(" ")}}";
}

View File

@ -16,6 +16,4 @@ class CssStylesheet extends CssParentNode {
visitor.visitStylesheet(this);
CssStylesheet copyWithoutChildren() => new CssStylesheet(span);
String toString() => children.join(" ");
}

View File

@ -12,6 +12,4 @@ class CssValue<T> implements AstNode {
final FileSpan span;
CssValue(this.value, this.span);
String toString() => value.toString();
}