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.metadata_builder; | 5 library fasta.metadata_builder; |
6 | 6 |
7 import 'builder.dart' show | 7 import 'builder.dart' show Builder, TypeBuilder; |
8 Builder, | |
9 TypeBuilder; | |
10 | 8 |
11 import 'constructor_reference_builder.dart' show | 9 import 'constructor_reference_builder.dart' show ConstructorReferenceBuilder; |
12 ConstructorReferenceBuilder; | |
13 | 10 |
14 abstract class MetadataBuilder<T extends TypeBuilder> extends Builder { | 11 abstract class MetadataBuilder<T extends TypeBuilder> extends Builder { |
15 MetadataBuilder(Builder parent, int charOffset) | 12 MetadataBuilder(Builder parent, int charOffset) |
16 : super(parent, -1, parent.fileUri); | 13 : super(parent, -1, parent.fileUri); |
17 | 14 |
18 factory MetadataBuilder.fromConstructor( | 15 factory MetadataBuilder.fromConstructor( |
19 ConstructorReferenceBuilder constructorReference, List arguments, | 16 ConstructorReferenceBuilder constructorReference, |
20 Builder parent, int charOffset) { | 17 List arguments, |
21 return new ConstructorMetadataBuilder(constructorReference, arguments, | 18 Builder parent, |
22 parent, charOffset); | 19 int charOffset) { |
| 20 return new ConstructorMetadataBuilder( |
| 21 constructorReference, arguments, parent, charOffset); |
23 } | 22 } |
24 | 23 |
25 factory MetadataBuilder.fromExpression(String expression, String postfix, | 24 factory MetadataBuilder.fromExpression( |
26 Builder parent, int charOffset) { | 25 String expression, String postfix, Builder parent, int charOffset) { |
27 return new ExpressionMetadataBuilder( | 26 return new ExpressionMetadataBuilder( |
28 expression, postfix, parent, charOffset); | 27 expression, postfix, parent, charOffset); |
29 } | 28 } |
30 } | 29 } |
31 | 30 |
32 class ConstructorMetadataBuilder<T extends TypeBuilder> | 31 class ConstructorMetadataBuilder<T extends TypeBuilder> |
33 extends MetadataBuilder<T> { | 32 extends MetadataBuilder<T> { |
34 final ConstructorReferenceBuilder constructorReference; | 33 final ConstructorReferenceBuilder constructorReference; |
35 | 34 |
36 final List arguments; | 35 final List arguments; |
37 | 36 |
38 ConstructorMetadataBuilder(this.constructorReference, this.arguments, | 37 ConstructorMetadataBuilder( |
39 Builder parent, int charOffset) | 38 this.constructorReference, this.arguments, Builder parent, int charOffset) |
40 : super(parent, charOffset); | 39 : super(parent, charOffset); |
41 } | 40 } |
42 | 41 |
43 /// Expression metadata (without arguments). | 42 /// Expression metadata (without arguments). |
44 /// | 43 /// |
45 /// Matches this grammar rule: | 44 /// Matches this grammar rule: |
46 /// | 45 /// |
47 /// '@' qualified (‘.’ identifier)? | 46 /// '@' qualified (‘.’ identifier)? |
48 class ExpressionMetadataBuilder<T extends TypeBuilder> | 47 class ExpressionMetadataBuilder<T extends TypeBuilder> |
49 extends MetadataBuilder<T> { | 48 extends MetadataBuilder<T> { |
50 final String qualified; | 49 final String qualified; |
51 | 50 |
52 final String identifier; | 51 final String identifier; |
53 | 52 |
54 ExpressionMetadataBuilder(this.qualified, this.identifier, Builder parent, | 53 ExpressionMetadataBuilder( |
55 int charOffset) | 54 this.qualified, this.identifier, Builder parent, int charOffset) |
56 : super(parent, charOffset); | 55 : super(parent, charOffset); |
57 } | 56 } |
OLD | NEW |