OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.formal_parameter_builder; | 5 library fasta.formal_parameter_builder; |
6 | 6 |
7 import '../parser/parser.dart' show FormalParameterType; | 7 import '../parser/parser.dart' show FormalParameterType; |
8 | 8 |
9 import 'builder.dart' | 9 import 'builder.dart' |
10 show LibraryBuilder, MetadataBuilder, ModifierBuilder, TypeBuilder; | 10 show LibraryBuilder, MetadataBuilder, ModifierBuilder, TypeBuilder; |
11 | 11 |
12 abstract class FormalParameterBuilder<T extends TypeBuilder> | 12 abstract class FormalParameterBuilder<T extends TypeBuilder> |
13 extends ModifierBuilder { | 13 extends ModifierBuilder { |
| 14 @override |
| 15 final int charOffset; |
| 16 |
14 final List<MetadataBuilder> metadata; | 17 final List<MetadataBuilder> metadata; |
15 | 18 |
16 final int modifiers; | 19 final int modifiers; |
17 | 20 |
18 final T type; | 21 final T type; |
19 | 22 |
20 final String name; | 23 final String name; |
21 | 24 |
22 /// True if this parameter is on the form `this.name`. | 25 /// True if this parameter is on the form `this.name`. |
23 final bool hasThis; | 26 final bool hasThis; |
24 | 27 |
25 FormalParameterType kind = FormalParameterType.REQUIRED; | 28 FormalParameterType kind = FormalParameterType.REQUIRED; |
26 | 29 |
27 FormalParameterBuilder(this.metadata, this.modifiers, this.type, this.name, | 30 FormalParameterBuilder(this.metadata, this.modifiers, this.type, this.name, |
28 this.hasThis, LibraryBuilder compilationUnit, int charOffset) | 31 this.hasThis, LibraryBuilder compilationUnit, this.charOffset) |
29 : super(compilationUnit, charOffset); | 32 : super(compilationUnit, charOffset); |
30 | 33 |
31 bool get isRequired => kind.isRequired; | 34 bool get isRequired => kind.isRequired; |
32 | 35 |
33 bool get isPositional => kind.isPositional || kind.isRequired; | 36 bool get isPositional => kind.isPositional || kind.isRequired; |
34 | 37 |
35 bool get isNamed => kind.isNamed; | 38 bool get isNamed => kind.isNamed; |
36 | 39 |
37 bool get isOptional => !isRequired; | 40 bool get isOptional => !isRequired; |
38 | 41 |
39 bool get isLocal => true; | 42 bool get isLocal => true; |
40 | 43 |
41 @override | 44 @override |
42 String get fullNameForErrors => name; | 45 String get fullNameForErrors => name; |
43 } | 46 } |
OLD | NEW |