OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /** | 5 /** |
6 * This file contains a set of concrete classes representing an in-memory | 6 * This file contains a set of concrete classes representing an in-memory |
7 * semantic model of the IDL used to code generate summary serialization and | 7 * semantic model of the IDL used to code generate summary serialization and |
8 * deserialization code. | 8 * deserialization code. |
9 */ | 9 */ |
10 library analyzer.tool.summary.idl_model; | 10 library analyzer.tool.summary.idl_model; |
11 | 11 |
12 /** | 12 /** |
13 * Information about a single class defined in the IDL. | 13 * Information about a single class defined in the IDL. |
14 */ | 14 */ |
15 class ClassDeclaration extends Declaration { | 15 class ClassDeclaration extends Declaration { |
16 /** | 16 /** |
17 * Fields defined in the class. | 17 * All fields defined in the class, including deprecated ones. |
18 */ | 18 */ |
19 final List<FieldDeclaration> fields = <FieldDeclaration>[]; | 19 final List<FieldDeclaration> allFields = <FieldDeclaration>[]; |
20 | 20 |
21 /** | 21 /** |
22 * Indicates whether the class has the `topLevel` annotation. | 22 * Indicates whether the class has the `topLevel` annotation. |
23 */ | 23 */ |
24 final bool isTopLevel; | 24 final bool isTopLevel; |
25 | 25 |
26 /** | 26 /** |
27 * If [isTopLevel] is `true` and a file identifier was specified for this | 27 * If [isTopLevel] is `true` and a file identifier was specified for this |
28 * class, the file identifier string. Otheswise `null`. | 28 * class, the file identifier string. Otheswise `null`. |
29 */ | 29 */ |
30 final String fileIdentifier; | 30 final String fileIdentifier; |
31 | 31 |
32 ClassDeclaration( | 32 ClassDeclaration( |
33 String documentation, String name, this.isTopLevel, this.fileIdentifier) | 33 String documentation, String name, this.isTopLevel, this.fileIdentifier) |
34 : super(documentation, name); | 34 : super(documentation, name); |
| 35 |
| 36 /** |
| 37 * Get the non-deprecated fields defined in the class. |
| 38 */ |
| 39 Iterable<FieldDeclaration> get fields => |
| 40 allFields.where((FieldDeclaration field) => !field.isDeprecated); |
35 } | 41 } |
36 | 42 |
37 /** | 43 /** |
38 * Information about a declaration in the IDL. | 44 * Information about a declaration in the IDL. |
39 */ | 45 */ |
40 class Declaration { | 46 class Declaration { |
41 /** | 47 /** |
42 * The optional documentation, may be `null`. | 48 * The optional documentation, may be `null`. |
43 */ | 49 */ |
44 final String documentation; | 50 final String documentation; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 /** | 85 /** |
80 * The file of the field. | 86 * The file of the field. |
81 */ | 87 */ |
82 final FieldType type; | 88 final FieldType type; |
83 | 89 |
84 /** | 90 /** |
85 * The id of the field. | 91 * The id of the field. |
86 */ | 92 */ |
87 final int id; | 93 final int id; |
88 | 94 |
89 FieldDeclaration(String documentation, String name, this.type, this.id) | 95 /** |
| 96 * Indicates whether the field is deprecated. |
| 97 */ |
| 98 final bool isDeprecated; |
| 99 |
| 100 FieldDeclaration( |
| 101 String documentation, String name, this.type, this.id, this.isDeprecated) |
90 : super(documentation, name); | 102 : super(documentation, name); |
91 } | 103 } |
92 | 104 |
93 /** | 105 /** |
94 * Information about the type of a class field defined in the IDL. | 106 * Information about the type of a class field defined in the IDL. |
95 */ | 107 */ |
96 class FieldType { | 108 class FieldType { |
97 /** | 109 /** |
98 * Type of the field (e.g. 'int'). | 110 * Type of the field (e.g. 'int'). |
99 */ | 111 */ |
(...skipping 15 matching lines...) Expand all Loading... |
115 /** | 127 /** |
116 * Classes defined in the IDL. | 128 * Classes defined in the IDL. |
117 */ | 129 */ |
118 final Map<String, ClassDeclaration> classes = <String, ClassDeclaration>{}; | 130 final Map<String, ClassDeclaration> classes = <String, ClassDeclaration>{}; |
119 | 131 |
120 /** | 132 /** |
121 * Enums defined in the IDL. | 133 * Enums defined in the IDL. |
122 */ | 134 */ |
123 final Map<String, EnumDeclaration> enums = <String, EnumDeclaration>{}; | 135 final Map<String, EnumDeclaration> enums = <String, EnumDeclaration>{}; |
124 } | 136 } |
OLD | NEW |