/
placeholder.dart
35 lines (26 loc) · 1.12 KB
/
placeholder.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
// 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 '../../util/character.dart' as character;
import '../../visitor/interface/selector.dart';
import '../selector.dart';
/// A placeholder selector.
///
/// This doesn't match any elements. It's intended to be extended using
/// `@extend`. It's not a plain CSS selector—it should be removed before
/// emitting a CSS document.
class PlaceholderSelector extends SimpleSelector {
/// The name of the placeholder.
final String name;
bool get isInvisible => true;
/// Returns whether this is a private selector (that is, whether it begins
/// with `-` or `_`).
bool get isPrivate => character.isPrivate(name);
PlaceholderSelector(this.name);
T accept<T>(SelectorVisitor<T> visitor) =>
visitor.visitPlaceholderSelector(this);
PlaceholderSelector addSuffix(String suffix) =>
PlaceholderSelector(name + suffix);
bool operator ==(other) => other is PlaceholderSelector && other.name == name;
int get hashCode => name.hashCode;
}