| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /** |
| 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 |
| 8 * deserialization code. |
| 9 */ |
| 10 library analyzer.tool.summary.idl_model; |
| 11 |
| 12 /** |
| 13 * Information about a single class defined in the IDL. |
| 14 */ |
| 15 class ClassDeclaration extends Declaration { |
| 16 /** |
| 17 * All fields defined in the class, including deprecated ones. |
| 18 */ |
| 19 final List<FieldDeclaration> allFields = <FieldDeclaration>[]; |
| 20 |
| 21 /** |
| 22 * Indicates whether the class has the `topLevel` annotation. |
| 23 */ |
| 24 final bool isTopLevel; |
| 25 |
| 26 /** |
| 27 * If [isTopLevel] is `true` and a file identifier was specified for this |
| 28 * class, the file identifier string. Otherwise `null`. |
| 29 */ |
| 30 final String fileIdentifier; |
| 31 |
| 32 ClassDeclaration( |
| 33 String documentation, String name, this.isTopLevel, this.fileIdentifier) |
| 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); |
| 41 } |
| 42 |
| 43 /** |
| 44 * Information about a declaration in the IDL. |
| 45 */ |
| 46 class Declaration { |
| 47 /** |
| 48 * The optional documentation, may be `null`. |
| 49 */ |
| 50 final String documentation; |
| 51 |
| 52 /** |
| 53 * The name of the declaration. |
| 54 */ |
| 55 final String name; |
| 56 |
| 57 Declaration(this.documentation, this.name); |
| 58 } |
| 59 |
| 60 /** |
| 61 * Information about a single enum defined in the IDL. |
| 62 */ |
| 63 class EnumDeclaration extends Declaration { |
| 64 /** |
| 65 * List of enumerated values. |
| 66 */ |
| 67 final List<EnumValueDeclaration> values = <EnumValueDeclaration>[]; |
| 68 |
| 69 EnumDeclaration(String documentation, String name) |
| 70 : super(documentation, name); |
| 71 } |
| 72 |
| 73 /** |
| 74 * Information about a single enum value defined in the IDL. |
| 75 */ |
| 76 class EnumValueDeclaration extends Declaration { |
| 77 EnumValueDeclaration(String documentation, String name) |
| 78 : super(documentation, name); |
| 79 } |
| 80 |
| 81 /** |
| 82 * Information about a single class field defined in the IDL. |
| 83 */ |
| 84 class FieldDeclaration extends Declaration { |
| 85 /** |
| 86 * The file of the field. |
| 87 */ |
| 88 final FieldType type; |
| 89 |
| 90 /** |
| 91 * The id of the field. |
| 92 */ |
| 93 final int id; |
| 94 |
| 95 /** |
| 96 * Indicates whether the field is deprecated. |
| 97 */ |
| 98 final bool isDeprecated; |
| 99 |
| 100 /** |
| 101 * Indicates whether the field is informative. |
| 102 */ |
| 103 final bool isInformative; |
| 104 |
| 105 FieldDeclaration(String documentation, String name, this.type, this.id, |
| 106 this.isDeprecated, this.isInformative) |
| 107 : super(documentation, name); |
| 108 } |
| 109 |
| 110 /** |
| 111 * Information about the type of a class field defined in the IDL. |
| 112 */ |
| 113 class FieldType { |
| 114 /** |
| 115 * Type of the field (e.g. 'int'). |
| 116 */ |
| 117 final String typeName; |
| 118 |
| 119 /** |
| 120 * Indicates whether this field contains a list of the type specified in |
| 121 * [typeName]. |
| 122 */ |
| 123 final bool isList; |
| 124 |
| 125 FieldType(this.typeName, this.isList); |
| 126 |
| 127 @override |
| 128 String toString() => isList ? 'List<$typeName>' : typeName; |
| 129 } |
| 130 |
| 131 /** |
| 132 * Top level representation of the summary IDL. |
| 133 */ |
| 134 class Idl { |
| 135 /** |
| 136 * Classes defined in the IDL. |
| 137 */ |
| 138 final Map<String, ClassDeclaration> classes = <String, ClassDeclaration>{}; |
| 139 |
| 140 /** |
| 141 * Enums defined in the IDL. |
| 142 */ |
| 143 final Map<String, EnumDeclaration> enums = <String, EnumDeclaration>{}; |
| 144 } |
| OLD | NEW |