-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathat_rule.dart
42 lines (34 loc) · 1.24 KB
/
at_rule.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2019 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/interface/modifiable_css.dart';
import '../at_rule.dart';
import '../value.dart';
import 'node.dart';
/// A modifiable version of [CssAtRule] for use in the evaluation step.
final class ModifiableCssAtRule extends ModifiableCssParentNode
implements CssAtRule {
final CssValue<String> name;
final CssValue<String>? value;
final bool isChildless;
final FileSpan span;
ModifiableCssAtRule(
this.name,
this.span, {
bool childless = false,
this.value,
}) : isChildless = childless;
T accept<T>(ModifiableCssVisitor<T> visitor) => visitor.visitCssAtRule(this);
bool equalsIgnoringChildren(ModifiableCssNode other) =>
other is ModifiableCssAtRule &&
name == other.name &&
value == other.value &&
isChildless == other.isChildless;
ModifiableCssAtRule copyWithoutChildren() =>
ModifiableCssAtRule(name, span, childless: isChildless, value: value);
void addChild(ModifiableCssNode child) {
assert(!isChildless);
super.addChild(child);
}
}