| 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 is an "idl" style description of the summary format. It is not | 6 * This file is an "idl" style description of the summary format. It is not |
| 7 * executed directly; instead it is parsed and transformed into code that | 7 * executed directly; instead it is parsed and transformed into code that |
| 8 * implements the summary format. | 8 * implements the summary format. |
| 9 * | 9 * |
| 10 * The code generation process introduces the following non-typical semantics: | 10 * The code generation process introduces the following non-typical semantics: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 */ | 60 */ |
| 61 const private = null; | 61 const private = null; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Annotation describing a class which can be the top level object in an | 64 * Annotation describing a class which can be the top level object in an |
| 65 * encoded summary. | 65 * encoded summary. |
| 66 */ | 66 */ |
| 67 const topLevel = null; | 67 const topLevel = null; |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Summary information about a reference to a an entity such as a type, top |
| 71 * level executable, or executable within a class. |
| 72 */ |
| 73 class EntityRef { |
| 74 /** |
| 75 * If this [EntityRef] is contained within [LinkedUnit.types], slot id (which |
| 76 * is unique within the compilation unit) identifying the target of type |
| 77 * propagation or type inference with which this [EntityRef] is associated. |
| 78 * |
| 79 * Otherwise zero. |
| 80 */ |
| 81 int slot; |
| 82 |
| 83 /** |
| 84 * Index into [UnlinkedUnit.references] for the entity being referred to, or |
| 85 * zero if this is a reference to a type parameter. |
| 86 * |
| 87 * Note that since zero is also a valid index into |
| 88 * [UnlinkedUnit.references], we cannot distinguish between references to |
| 89 * type parameters and references to other entities by checking [reference] |
| 90 * against zero. To distinguish between references to type parameters and |
| 91 * references to other entities, check whether [paramReference] is zero. |
| 92 */ |
| 93 int reference; |
| 94 |
| 95 /** |
| 96 * If this is a reference to a type parameter, one-based index into the list |
| 97 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De |
| 98 * Bruijn index conventions; that is, innermost parameters come first, and |
| 99 * if a class or method has multiple parameters, they are indexed from right |
| 100 * to left. So for instance, if the enclosing declaration is |
| 101 * |
| 102 * class C<T,U> { |
| 103 * m<V,W> { |
| 104 * ... |
| 105 * } |
| 106 * } |
| 107 * |
| 108 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, |
| 109 * respectively. |
| 110 * |
| 111 * If the type being referred to is not a type parameter, [paramReference] is |
| 112 * zero. |
| 113 */ |
| 114 int paramReference; |
| 115 |
| 116 /** |
| 117 * If this is an instantiation of a generic type or generic executable, the |
| 118 * type arguments used to instantiate it. Trailing type arguments of type |
| 119 * `dynamic` are omitted. |
| 120 */ |
| 121 List<EntityRef> typeArguments; |
| 122 } |
| 123 |
| 124 /** |
| 70 * Information about a dependency that exists between one library and another | 125 * Information about a dependency that exists between one library and another |
| 71 * due to an "import" declaration. | 126 * due to an "import" declaration. |
| 72 */ | 127 */ |
| 73 class LinkedDependency { | 128 class LinkedDependency { |
| 74 /** | 129 /** |
| 75 * The relative URI of the dependent library. This URI is relative to the | 130 * The relative URI of the dependent library. This URI is relative to the |
| 76 * importing library, even if there are intervening `export` declarations. | 131 * importing library, even if there are intervening `export` declarations. |
| 77 * So, for example, if `a.dart` imports `b/c.dart` and `b/c.dart` exports | 132 * So, for example, if `a.dart` imports `b/c.dart` and `b/c.dart` exports |
| 78 * `d/e.dart`, the URI listed for `a.dart`'s dependency on `e.dart` will be | 133 * `d/e.dart`, the URI listed for `a.dart`'s dependency on `e.dart` will be |
| 79 * `b/d/e.dart`. | 134 * `b/d/e.dart`. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 * elements beyond the number of elements in [UnlinkedUnit.references], those | 275 * elements beyond the number of elements in [UnlinkedUnit.references], those |
| 221 * additional elements are references that are only referred to implicitly | 276 * additional elements are references that are only referred to implicitly |
| 222 * (e.g. elements involved in inferred or propagated types). | 277 * (e.g. elements involved in inferred or propagated types). |
| 223 */ | 278 */ |
| 224 List<LinkedReference> references; | 279 List<LinkedReference> references; |
| 225 | 280 |
| 226 /** | 281 /** |
| 227 * List associating slot ids found inside the unlinked summary for the | 282 * List associating slot ids found inside the unlinked summary for the |
| 228 * compilation unit with propagated and inferred types. | 283 * compilation unit with propagated and inferred types. |
| 229 */ | 284 */ |
| 230 List<TypeRef> types; | 285 List<EntityRef> types; |
| 231 } | 286 } |
| 232 | 287 |
| 233 /** | 288 /** |
| 234 * Enum used to indicate the kind of entity referred to by a | 289 * Enum used to indicate the kind of entity referred to by a |
| 235 * [LinkedReference]. | 290 * [LinkedReference]. |
| 236 */ | 291 */ |
| 237 enum ReferenceKind { | 292 enum ReferenceKind { |
| 238 /** | 293 /** |
| 239 * The entity is a class or enum. | 294 * The entity is a class or enum. |
| 240 */ | 295 */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 */ | 341 */ |
| 287 List<String> unlinkedUnitUris; | 342 List<String> unlinkedUnitUris; |
| 288 | 343 |
| 289 /** | 344 /** |
| 290 * Unlinked information for the compilation units constituting the SDK. | 345 * Unlinked information for the compilation units constituting the SDK. |
| 291 */ | 346 */ |
| 292 List<UnlinkedUnit> unlinkedUnits; | 347 List<UnlinkedUnit> unlinkedUnits; |
| 293 } | 348 } |
| 294 | 349 |
| 295 /** | 350 /** |
| 296 * Summary information about a reference to a type. | |
| 297 */ | |
| 298 class TypeRef { | |
| 299 /** | |
| 300 * If this [TypeRef] is contained within [LinkedUnit.types], slot id (which | |
| 301 * is unique within the compilation unit) identifying the target of type | |
| 302 * propagation or type inference with which this [TypeRef] is associated. | |
| 303 * | |
| 304 * Otherwise zero. | |
| 305 */ | |
| 306 int slot; | |
| 307 | |
| 308 /** | |
| 309 * Index into [UnlinkedUnit.references] for the type being referred to, or | |
| 310 * zero if this is a reference to a type parameter. | |
| 311 * | |
| 312 * Note that since zero is also a valid index into | |
| 313 * [UnlinkedUnit.references], we cannot distinguish between references to | |
| 314 * type parameters and references to types by checking [reference] against | |
| 315 * zero. To distinguish between references to type parameters and references | |
| 316 * to types, check whether [paramReference] is zero. | |
| 317 */ | |
| 318 int reference; | |
| 319 | |
| 320 /** | |
| 321 * If this is a reference to a type parameter, one-based index into the list | |
| 322 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De | |
| 323 * Bruijn index conventions; that is, innermost parameters come first, and | |
| 324 * if a class or method has multiple parameters, they are indexed from right | |
| 325 * to left. So for instance, if the enclosing declaration is | |
| 326 * | |
| 327 * class C<T,U> { | |
| 328 * m<V,W> { | |
| 329 * ... | |
| 330 * } | |
| 331 * } | |
| 332 * | |
| 333 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, | |
| 334 * respectively. | |
| 335 * | |
| 336 * If the type being referred to is not a type parameter, [paramReference] is | |
| 337 * zero. | |
| 338 */ | |
| 339 int paramReference; | |
| 340 | |
| 341 /** | |
| 342 * If this is an instantiation of a generic type, the type arguments used to | |
| 343 * instantiate it. Trailing type arguments of type `dynamic` are omitted. | |
| 344 */ | |
| 345 List<TypeRef> typeArguments; | |
| 346 } | |
| 347 | |
| 348 /** | |
| 349 * Unlinked summary information about a class declaration. | 351 * Unlinked summary information about a class declaration. |
| 350 */ | 352 */ |
| 351 class UnlinkedClass { | 353 class UnlinkedClass { |
| 352 /** | 354 /** |
| 353 * Name of the class. | 355 * Name of the class. |
| 354 */ | 356 */ |
| 355 String name; | 357 String name; |
| 356 | 358 |
| 357 /** | 359 /** |
| 358 * Offset of the class name relative to the beginning of the file. | 360 * Offset of the class name relative to the beginning of the file. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 370 /** | 372 /** |
| 371 * Type parameters of the class, if any. | 373 * Type parameters of the class, if any. |
| 372 */ | 374 */ |
| 373 List<UnlinkedTypeParam> typeParameters; | 375 List<UnlinkedTypeParam> typeParameters; |
| 374 | 376 |
| 375 /** | 377 /** |
| 376 * Supertype of the class, or `null` if either (a) the class doesn't | 378 * Supertype of the class, or `null` if either (a) the class doesn't |
| 377 * explicitly declare a supertype (and hence has supertype `Object`), or (b) | 379 * explicitly declare a supertype (and hence has supertype `Object`), or (b) |
| 378 * the class *is* `Object` (and hence has no supertype). | 380 * the class *is* `Object` (and hence has no supertype). |
| 379 */ | 381 */ |
| 380 TypeRef supertype; | 382 EntityRef supertype; |
| 381 | 383 |
| 382 /** | 384 /** |
| 383 * Mixins appearing in a `with` clause, if any. | 385 * Mixins appearing in a `with` clause, if any. |
| 384 */ | 386 */ |
| 385 List<TypeRef> mixins; | 387 List<EntityRef> mixins; |
| 386 | 388 |
| 387 /** | 389 /** |
| 388 * Interfaces appearing in an `implements` clause, if any. | 390 * Interfaces appearing in an `implements` clause, if any. |
| 389 */ | 391 */ |
| 390 List<TypeRef> interfaces; | 392 List<EntityRef> interfaces; |
| 391 | 393 |
| 392 /** | 394 /** |
| 393 * Field declarations contained in the class. | 395 * Field declarations contained in the class. |
| 394 */ | 396 */ |
| 395 List<UnlinkedVariable> fields; | 397 List<UnlinkedVariable> fields; |
| 396 | 398 |
| 397 /** | 399 /** |
| 398 * Executable objects (methods, getters, and setters) contained in the class. | 400 * Executable objects (methods, getters, and setters) contained in the class. |
| 399 */ | 401 */ |
| 400 List<UnlinkedExecutable> executables; | 402 List<UnlinkedExecutable> executables; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 * `invokeConstructor`. | 468 * `invokeConstructor`. |
| 467 */ | 469 */ |
| 468 List<String> strings; | 470 List<String> strings; |
| 469 | 471 |
| 470 /** | 472 /** |
| 471 * Sequence of language constructs consumed by the operations | 473 * Sequence of language constructs consumed by the operations |
| 472 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note | 474 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note |
| 473 * that in the case of `pushReference` (and sometimes `invokeConstructor` the | 475 * that in the case of `pushReference` (and sometimes `invokeConstructor` the |
| 474 * actual entity being referred to may be something other than a type. | 476 * actual entity being referred to may be something other than a type. |
| 475 */ | 477 */ |
| 476 List<TypeRef> references; | 478 List<EntityRef> references; |
| 477 } | 479 } |
| 478 | 480 |
| 479 /** | 481 /** |
| 480 * Enum representing the various kinds of operations which may be performed to | 482 * Enum representing the various kinds of operations which may be performed to |
| 481 * produce a constant value. These options are assumed to execute in the | 483 * produce a constant value. These options are assumed to execute in the |
| 482 * context of a stack which is initially empty. | 484 * context of a stack which is initially empty. |
| 483 */ | 485 */ |
| 484 enum UnlinkedConstOperation { | 486 enum UnlinkedConstOperation { |
| 485 /** | 487 /** |
| 486 * Push the value of the n-th constructor argument (where n is obtained from | 488 * Push the value of the n-th constructor argument (where n is obtained from |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 * Type parameters of the executable, if any. Empty if support for generic | 860 * Type parameters of the executable, if any. Empty if support for generic |
| 859 * method syntax is disabled. | 861 * method syntax is disabled. |
| 860 */ | 862 */ |
| 861 List<UnlinkedTypeParam> typeParameters; | 863 List<UnlinkedTypeParam> typeParameters; |
| 862 | 864 |
| 863 /** | 865 /** |
| 864 * Declared return type of the executable. Absent if the return type is | 866 * Declared return type of the executable. Absent if the return type is |
| 865 * `void` or the executable is a constructor. Note that when strong mode is | 867 * `void` or the executable is a constructor. Note that when strong mode is |
| 866 * enabled, the actual return type may be different due to type inference. | 868 * enabled, the actual return type may be different due to type inference. |
| 867 */ | 869 */ |
| 868 TypeRef returnType; | 870 EntityRef returnType; |
| 869 | 871 |
| 870 /** | 872 /** |
| 871 * Parameters of the executable, if any. Note that getters have no | 873 * Parameters of the executable, if any. Note that getters have no |
| 872 * parameters (hence this will be the empty list), and setters have a single | 874 * parameters (hence this will be the empty list), and setters have a single |
| 873 * parameter. | 875 * parameter. |
| 874 */ | 876 */ |
| 875 List<UnlinkedParam> parameters; | 877 List<UnlinkedParam> parameters; |
| 876 | 878 |
| 877 /** | 879 /** |
| 878 * The kind of the executable (function/method, getter, setter, or | 880 * The kind of the executable (function/method, getter, setter, or |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 @informative | 1061 @informative |
| 1060 int nameOffset; | 1062 int nameOffset; |
| 1061 | 1063 |
| 1062 /** | 1064 /** |
| 1063 * If [isFunctionTyped] is `true`, the declared return type. If | 1065 * If [isFunctionTyped] is `true`, the declared return type. If |
| 1064 * [isFunctionTyped] is `false`, the declared type. Absent if | 1066 * [isFunctionTyped] is `false`, the declared type. Absent if |
| 1065 * [isFunctionTyped] is `true` and the declared return type is `void`. Note | 1067 * [isFunctionTyped] is `true` and the declared return type is `void`. Note |
| 1066 * that when strong mode is enabled, the actual type may be different due to | 1068 * that when strong mode is enabled, the actual type may be different due to |
| 1067 * type inference. | 1069 * type inference. |
| 1068 */ | 1070 */ |
| 1069 TypeRef type; | 1071 EntityRef type; |
| 1070 | 1072 |
| 1071 /** | 1073 /** |
| 1072 * If [isFunctionTyped] is `true`, the parameters of the function type. | 1074 * If [isFunctionTyped] is `true`, the parameters of the function type. |
| 1073 */ | 1075 */ |
| 1074 List<UnlinkedParam> parameters; | 1076 List<UnlinkedParam> parameters; |
| 1075 | 1077 |
| 1076 /** | 1078 /** |
| 1077 * Kind of the parameter. | 1079 * Kind of the parameter. |
| 1078 */ | 1080 */ |
| 1079 UnlinkedParamKind kind; | 1081 UnlinkedParamKind kind; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 UnlinkedDocumentationComment documentationComment; | 1240 UnlinkedDocumentationComment documentationComment; |
| 1239 | 1241 |
| 1240 /** | 1242 /** |
| 1241 * Type parameters of the typedef, if any. | 1243 * Type parameters of the typedef, if any. |
| 1242 */ | 1244 */ |
| 1243 List<UnlinkedTypeParam> typeParameters; | 1245 List<UnlinkedTypeParam> typeParameters; |
| 1244 | 1246 |
| 1245 /** | 1247 /** |
| 1246 * Return type of the typedef. Absent if the return type is `void`. | 1248 * Return type of the typedef. Absent if the return type is `void`. |
| 1247 */ | 1249 */ |
| 1248 TypeRef returnType; | 1250 EntityRef returnType; |
| 1249 | 1251 |
| 1250 /** | 1252 /** |
| 1251 * Parameters of the executable, if any. | 1253 * Parameters of the executable, if any. |
| 1252 */ | 1254 */ |
| 1253 List<UnlinkedParam> parameters; | 1255 List<UnlinkedParam> parameters; |
| 1254 } | 1256 } |
| 1255 | 1257 |
| 1256 /** | 1258 /** |
| 1257 * Unlinked summary information about a type parameter declaration. | 1259 * Unlinked summary information about a type parameter declaration. |
| 1258 */ | 1260 */ |
| 1259 class UnlinkedTypeParam { | 1261 class UnlinkedTypeParam { |
| 1260 /** | 1262 /** |
| 1261 * Name of the type parameter. | 1263 * Name of the type parameter. |
| 1262 */ | 1264 */ |
| 1263 String name; | 1265 String name; |
| 1264 | 1266 |
| 1265 /** | 1267 /** |
| 1266 * Offset of the type parameter name relative to the beginning of the file. | 1268 * Offset of the type parameter name relative to the beginning of the file. |
| 1267 */ | 1269 */ |
| 1268 @informative | 1270 @informative |
| 1269 int nameOffset; | 1271 int nameOffset; |
| 1270 | 1272 |
| 1271 /** | 1273 /** |
| 1272 * Bound of the type parameter, if a bound is explicitly declared. Otherwise | 1274 * Bound of the type parameter, if a bound is explicitly declared. Otherwise |
| 1273 * null. | 1275 * null. |
| 1274 */ | 1276 */ |
| 1275 TypeRef bound; | 1277 EntityRef bound; |
| 1276 } | 1278 } |
| 1277 | 1279 |
| 1278 /** | 1280 /** |
| 1279 * Unlinked summary information about a compilation unit ("part file"). | 1281 * Unlinked summary information about a compilation unit ("part file"). |
| 1280 */ | 1282 */ |
| 1281 @topLevel | 1283 @topLevel |
| 1282 class UnlinkedUnit { | 1284 class UnlinkedUnit { |
| 1283 /** | 1285 /** |
| 1284 * Name of the library (from a "library" declaration, if present). | 1286 * Name of the library (from a "library" declaration, if present). |
| 1285 */ | 1287 */ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 * Documentation comment for the variable, or `null` if there is no | 1382 * Documentation comment for the variable, or `null` if there is no |
| 1381 * documentation comment. | 1383 * documentation comment. |
| 1382 */ | 1384 */ |
| 1383 @informative | 1385 @informative |
| 1384 UnlinkedDocumentationComment documentationComment; | 1386 UnlinkedDocumentationComment documentationComment; |
| 1385 | 1387 |
| 1386 /** | 1388 /** |
| 1387 * Declared type of the variable. Note that when strong mode is enabled, the | 1389 * Declared type of the variable. Note that when strong mode is enabled, the |
| 1388 * actual type of the variable may be different due to type inference. | 1390 * actual type of the variable may be different due to type inference. |
| 1389 */ | 1391 */ |
| 1390 TypeRef type; | 1392 EntityRef type; |
| 1391 | 1393 |
| 1392 /** | 1394 /** |
| 1393 * If [isConst] is true, and the variable has an initializer, the constant | 1395 * If [isConst] is true, and the variable has an initializer, the constant |
| 1394 * expression in the initializer. | 1396 * expression in the initializer. |
| 1395 */ | 1397 */ |
| 1396 UnlinkedConst constExpr; | 1398 UnlinkedConst constExpr; |
| 1397 | 1399 |
| 1398 /** | 1400 /** |
| 1399 * Indicates whether the variable is declared using the `static` keyword. | 1401 * Indicates whether the variable is declared using the `static` keyword. |
| 1400 * | 1402 * |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1422 /** | 1424 /** |
| 1423 * If this variable is propagable, nonzero slot id identifying which entry in | 1425 * If this variable is propagable, nonzero slot id identifying which entry in |
| 1424 * [LinkedLibrary.types] contains the propagated type for this variable. If | 1426 * [LinkedLibrary.types] contains the propagated type for this variable. If |
| 1425 * there is no matching entry in [LinkedLibrary.types], then this variable's | 1427 * there is no matching entry in [LinkedLibrary.types], then this variable's |
| 1426 * propagated type is the same as its declared type. | 1428 * propagated type is the same as its declared type. |
| 1427 * | 1429 * |
| 1428 * Non-propagable variables have a [propagatedTypeSlot] of zero. | 1430 * Non-propagable variables have a [propagatedTypeSlot] of zero. |
| 1429 */ | 1431 */ |
| 1430 int propagatedTypeSlot; | 1432 int propagatedTypeSlot; |
| 1431 } | 1433 } |
| OLD | NEW |