dart-sass/lib/src/ast/css/at_rule.dart
Natalie Weizenbaum e8756eb02d Make CssNodes directly mutable.
This shaves off a significant amount of time, since now we don't have to
do what is essentially a full copy of the CSS tree. We may want to use
interfaces to provide an immutable view of the CSS tree for use outside
of the perform visitor.
2016-08-30 15:51:19 -07:00

28 lines
755 B
Dart

// Copyright 2016 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import 'package:source_span/source_span.dart';
import '../../visitor/css.dart';
import 'node.dart';
import 'value.dart';
class CssAtRule extends CssParentNode {
final String name;
final CssValue<String> value;
final FileSpan span;
CssAtRule(this.name, {this.value, this.span});
/*=T*/ accept/*<T>*/(CssVisitor/*<T>*/ visitor) =>
visitor.visitAtRule(this);
String toString() {
var buffer = new StringBuffer("@$name");
if (value != null) buffer.write(" $value");
return children == null ? "$buffer;" : "$buffer {${children.join(" ")}}";
}
}