pedantic: ast/alias.dart
This commit is contained in:
parent
84037855fa
commit
6455dde6b6
3 changed files with 21 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
include: package:pedantic/analysis_options.yaml
|
||||||
analyzer:
|
analyzer:
|
||||||
strong-mode:
|
strong-mode:
|
||||||
implicit-casts: false
|
implicit-casts: false
|
|
@ -1,19 +1,32 @@
|
||||||
import 'package:source_span/source_span.dart';
|
import 'package:source_span/source_span.dart';
|
||||||
|
|
||||||
import '../token.dart';
|
import '../token.dart';
|
||||||
import 'node.dart';
|
import 'node.dart';
|
||||||
|
|
||||||
|
/// An alternate name for a field within a [SelectionSet].
|
||||||
class AliasContext extends Node {
|
class AliasContext extends Node {
|
||||||
final Token NAME1, COLON, NAME2;
|
/// The source tokens.
|
||||||
|
final Token name1, colon, name2;
|
||||||
|
|
||||||
AliasContext(this.NAME1, this.COLON, this.NAME2);
|
AliasContext(this.name1, this.colon, this.name2);
|
||||||
|
|
||||||
|
/// Use [name1] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get NAME1 => name1;
|
||||||
|
|
||||||
|
/// Use [colon] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get COLON => colon;
|
||||||
|
|
||||||
|
/// Use [name2] instead.
|
||||||
|
@deprecated
|
||||||
|
Token get NAME2 => name2;
|
||||||
|
|
||||||
/// The aliased name of the value.
|
/// The aliased name of the value.
|
||||||
String get alias => NAME1.text;
|
String get alias => name1.text;
|
||||||
|
|
||||||
/// The actual name of the value.
|
/// The actual name of the value.
|
||||||
String get name => NAME2.text;
|
String get name => name2.text;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSpan get span => NAME1.span.expand(COLON.span).expand(NAME2.span);
|
FileSpan get span => name1.span.expand(colon.span).expand(name2.span);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,5 @@ dependencies:
|
||||||
string_scanner: ^1.0.0
|
string_scanner: ^1.0.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
matcher: any
|
matcher: any
|
||||||
|
pedantic: ^1.0.0
|
||||||
test: ">=0.12.0 <2.0.0"
|
test: ">=0.12.0 <2.0.0"
|
||||||
|
|
Loading…
Reference in a new issue