| 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 is an "idl" style description of the summary format. It |
| 7 * contains abstract classes which declare the interface for reading data from |
| 8 * summaries. It is parsed and transformed into code that implements the |
| 9 * summary format. |
| 10 * |
| 11 * The code generation process introduces the following semantics: |
| 12 * - Getters of type List never return null, and have a default value of the |
| 13 * empty list. |
| 14 * - Getters of type int return unsigned 32-bit integers, never null, and have |
| 15 * a default value of zero. |
| 16 * - Getters of type String never return null, and have a default value of ''. |
| 17 * - Getters of type bool never return null, and have a default value of false. |
| 18 * - Getters whose type is an enum never return null, and have a default value |
| 19 * of the first value declared in the enum. |
| 20 * |
| 21 * Terminology used in this document: |
| 22 * - "Unlinked" refers to information that can be determined from reading a |
| 23 * single .dart file in isolation. |
| 24 * - "Prelinked" refers to information that can be determined from the defining |
| 25 * compilation unit of a library, plus direct imports, plus the transitive |
| 26 * closure of exports reachable from those libraries, plus all part files |
| 27 * constituting those libraries. |
| 28 * - "Linked" refers to all other information; in theory, this information may |
| 29 * depend on all files in the transitive import/export closure. However, in |
| 30 * practice we expect that the number of additional dependencies will usually |
| 31 * be small, since the additional dependencies only need to be consulted for |
| 32 * type propagation, type inference, and constant evaluation, which typically |
| 33 * have short dependency chains. |
| 34 * |
| 35 * Since we expect "linked" and "prelinked" dependencies to be similar, we only |
| 36 * rarely distinguish between them; most information is that is not "unlinked" |
| 37 * is typically considered "linked" for simplicity. |
| 38 * |
| 39 * Except as otherwise noted, synthetic elements are not stored in the summary; |
| 40 * they are re-synthesized at the time the summary is read. |
| 41 */ |
| 42 library analyzer.tool.summary.idl; |
| 43 |
| 44 import 'package:analyzer/dart/element/element.dart'; |
| 45 |
| 46 import 'base.dart' as base; |
| 47 import 'base.dart' show Id, TopLevel; |
| 48 import 'format.dart' as generated; |
| 49 |
| 50 /** |
| 51 * Annotation describing information which is not part of Dart semantics; in |
| 52 * other words, if this information (or any information it refers to) changes, |
| 53 * static analysis and runtime behavior of the library are unaffected. |
| 54 * |
| 55 * Information that has purely local effect (in other words, it does not affect |
| 56 * the API of the code being analyzed) is also marked as `informative`. |
| 57 */ |
| 58 const informative = null; |
| 59 |
| 60 /** |
| 61 * Information about an element code range. |
| 62 */ |
| 63 abstract class CodeRange extends base.SummaryClass { |
| 64 /** |
| 65 * Length of the element code. |
| 66 */ |
| 67 @Id(1) |
| 68 int get length; |
| 69 |
| 70 /** |
| 71 * Offset of the element code relative to the beginning of the file. |
| 72 */ |
| 73 @Id(0) |
| 74 int get offset; |
| 75 } |
| 76 |
| 77 /** |
| 78 * Summary information about a reference to a an entity such as a type, top |
| 79 * level executable, or executable within a class. |
| 80 */ |
| 81 abstract class EntityRef extends base.SummaryClass { |
| 82 /** |
| 83 * If this is a reference to a function type implicitly defined by a |
| 84 * function-typed parameter, a list of zero-based indices indicating the path |
| 85 * from the entity referred to by [reference] to the appropriate type |
| 86 * parameter. Otherwise the empty list. |
| 87 * |
| 88 * If there are N indices in this list, then the entity being referred to is |
| 89 * the function type implicitly defined by a function-typed parameter of a |
| 90 * function-typed parameter, to N levels of nesting. The first index in the |
| 91 * list refers to the outermost level of nesting; for example if [reference] |
| 92 * refers to the entity defined by: |
| 93 * |
| 94 * void f(x, void g(y, z, int h(String w))) { ... } |
| 95 * |
| 96 * Then to refer to the function type implicitly defined by parameter `h` |
| 97 * (which is parameter 2 of parameter 1 of `f`), then |
| 98 * [implicitFunctionTypeIndices] should be [1, 2]. |
| 99 * |
| 100 * Note that if the entity being referred to is a generic method inside a |
| 101 * generic class, then the type arguments in [typeArguments] are applied |
| 102 * first to the class and then to the method. |
| 103 */ |
| 104 @Id(4) |
| 105 List<int> get implicitFunctionTypeIndices; |
| 106 |
| 107 /** |
| 108 * If this is a reference to a type parameter, one-based index into the list |
| 109 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De |
| 110 * Bruijn index conventions; that is, innermost parameters come first, and |
| 111 * if a class or method has multiple parameters, they are indexed from right |
| 112 * to left. So for instance, if the enclosing declaration is |
| 113 * |
| 114 * class C<T,U> { |
| 115 * m<V,W> { |
| 116 * ... |
| 117 * } |
| 118 * } |
| 119 * |
| 120 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, |
| 121 * respectively. |
| 122 * |
| 123 * If the type being referred to is not a type parameter, [paramReference] is |
| 124 * zero. |
| 125 */ |
| 126 @Id(3) |
| 127 int get paramReference; |
| 128 |
| 129 /** |
| 130 * Index into [UnlinkedUnit.references] for the entity being referred to, or |
| 131 * zero if this is a reference to a type parameter. |
| 132 */ |
| 133 @Id(0) |
| 134 int get reference; |
| 135 |
| 136 /** |
| 137 * If this [EntityRef] is contained within [LinkedUnit.types], slot id (which |
| 138 * is unique within the compilation unit) identifying the target of type |
| 139 * propagation or type inference with which this [EntityRef] is associated. |
| 140 * |
| 141 * Otherwise zero. |
| 142 */ |
| 143 @Id(2) |
| 144 int get slot; |
| 145 |
| 146 /** |
| 147 * If this [EntityRef] is a reference to a function type whose |
| 148 * [FunctionElement] is not in any library (e.g. a function type that was |
| 149 * synthesized by a LUB computation), the function parameters. Otherwise |
| 150 * empty. |
| 151 */ |
| 152 @Id(6) |
| 153 List<UnlinkedParam> get syntheticParams; |
| 154 |
| 155 /** |
| 156 * If this [EntityRef] is a reference to a function type whose |
| 157 * [FunctionElement] is not in any library (e.g. a function type that was |
| 158 * synthesized by a LUB computation), the return type of the function. |
| 159 * Otherwise `null`. |
| 160 */ |
| 161 @Id(5) |
| 162 EntityRef get syntheticReturnType; |
| 163 |
| 164 /** |
| 165 * If this is an instantiation of a generic type or generic executable, the |
| 166 * type arguments used to instantiate it (if any). |
| 167 */ |
| 168 @Id(1) |
| 169 List<EntityRef> get typeArguments; |
| 170 } |
| 171 |
| 172 /** |
| 173 * Enum used to indicate the kind of a name in index. |
| 174 */ |
| 175 enum IndexNameKind { |
| 176 /** |
| 177 * A top-level element. |
| 178 */ |
| 179 topLevel, |
| 180 |
| 181 /** |
| 182 * A class member. |
| 183 */ |
| 184 classMember |
| 185 } |
| 186 |
| 187 /** |
| 188 * Enum used to indicate the kind of an index relation. |
| 189 */ |
| 190 enum IndexRelationKind { |
| 191 /** |
| 192 * Left: class. |
| 193 * Is ancestor of (is extended or implemented, directly or indirectly). |
| 194 * Right: other class declaration. |
| 195 */ |
| 196 IS_ANCESTOR_OF, |
| 197 |
| 198 /** |
| 199 * Left: class. |
| 200 * Is extended by. |
| 201 * Right: other class declaration. |
| 202 */ |
| 203 IS_EXTENDED_BY, |
| 204 |
| 205 /** |
| 206 * Left: class. |
| 207 * Is implemented by. |
| 208 * Right: other class declaration. |
| 209 */ |
| 210 IS_IMPLEMENTED_BY, |
| 211 |
| 212 /** |
| 213 * Left: class. |
| 214 * Is mixed into. |
| 215 * Right: other class declaration. |
| 216 */ |
| 217 IS_MIXED_IN_BY, |
| 218 |
| 219 /** |
| 220 * Left: method, property accessor, function, variable. |
| 221 * Is invoked at. |
| 222 * Right: location. |
| 223 */ |
| 224 IS_INVOKED_BY, |
| 225 |
| 226 /** |
| 227 * Left: any element. |
| 228 * Is referenced (and not invoked, read/written) at. |
| 229 * Right: location. |
| 230 */ |
| 231 IS_REFERENCED_BY, |
| 232 |
| 233 /** |
| 234 * Left: unresolved member name. |
| 235 * Is read at. |
| 236 * Right: location. |
| 237 */ |
| 238 IS_READ_BY, |
| 239 |
| 240 /** |
| 241 * Left: unresolved member name. |
| 242 * Is both read and written at. |
| 243 * Right: location. |
| 244 */ |
| 245 IS_READ_WRITTEN_BY, |
| 246 |
| 247 /** |
| 248 * Left: unresolved member name. |
| 249 * Is written at. |
| 250 * Right: location. |
| 251 */ |
| 252 IS_WRITTEN_BY |
| 253 } |
| 254 |
| 255 /** |
| 256 * When we need to reference a synthetic element in [PackageIndex] we use a |
| 257 * value of this enum to specify which kind of the synthetic element we |
| 258 * actually reference. |
| 259 */ |
| 260 enum IndexSyntheticElementKind { |
| 261 /** |
| 262 * Not a synthetic element. |
| 263 */ |
| 264 notSynthetic, |
| 265 |
| 266 /** |
| 267 * The unnamed synthetic constructor a class element. |
| 268 */ |
| 269 constructor, |
| 270 |
| 271 /** |
| 272 * The synthetic field element. |
| 273 */ |
| 274 field, |
| 275 |
| 276 /** |
| 277 * The synthetic getter of a property introducing element. |
| 278 */ |
| 279 getter, |
| 280 |
| 281 /** |
| 282 * The synthetic setter of a property introducing element. |
| 283 */ |
| 284 setter, |
| 285 |
| 286 /** |
| 287 * The synthetic top-level variable element. |
| 288 */ |
| 289 topLevelVariable, |
| 290 |
| 291 /** |
| 292 * The synthetic `loadLibrary` element. |
| 293 */ |
| 294 loadLibrary, |
| 295 |
| 296 /** |
| 297 * The synthetic `index` getter of an enum. |
| 298 */ |
| 299 enumIndex, |
| 300 |
| 301 /** |
| 302 * The synthetic `values` getter of an enum. |
| 303 */ |
| 304 enumValues, |
| 305 |
| 306 /** |
| 307 * The containing unit itself. |
| 308 */ |
| 309 unit |
| 310 } |
| 311 |
| 312 /** |
| 313 * Information about a dependency that exists between one library and another |
| 314 * due to an "import" declaration. |
| 315 */ |
| 316 abstract class LinkedDependency extends base.SummaryClass { |
| 317 /** |
| 318 * URI for the compilation units listed in the library's `part` declarations. |
| 319 * These URIs are relative to the importing library. |
| 320 */ |
| 321 @Id(1) |
| 322 List<String> get parts; |
| 323 |
| 324 /** |
| 325 * The relative URI of the dependent library. This URI is relative to the |
| 326 * importing library, even if there are intervening `export` declarations. |
| 327 * So, for example, if `a.dart` imports `b/c.dart` and `b/c.dart` exports |
| 328 * `d/e.dart`, the URI listed for `a.dart`'s dependency on `e.dart` will be |
| 329 * `b/d/e.dart`. |
| 330 */ |
| 331 @Id(0) |
| 332 String get uri; |
| 333 } |
| 334 |
| 335 /** |
| 336 * Information about a single name in the export namespace of the library that |
| 337 * is not in the public namespace. |
| 338 */ |
| 339 abstract class LinkedExportName extends base.SummaryClass { |
| 340 /** |
| 341 * Index into [LinkedLibrary.dependencies] for the library in which the |
| 342 * entity is defined. |
| 343 */ |
| 344 @Id(0) |
| 345 int get dependency; |
| 346 |
| 347 /** |
| 348 * The kind of the entity being referred to. |
| 349 */ |
| 350 @Id(3) |
| 351 ReferenceKind get kind; |
| 352 |
| 353 /** |
| 354 * Name of the exported entity. For an exported setter, this name includes |
| 355 * the trailing '='. |
| 356 */ |
| 357 @Id(1) |
| 358 String get name; |
| 359 |
| 360 /** |
| 361 * Integer index indicating which unit in the exported library contains the |
| 362 * definition of the entity. As with indices into [LinkedLibrary.units], |
| 363 * zero represents the defining compilation unit, and nonzero values |
| 364 * represent parts in the order of the corresponding `part` declarations. |
| 365 */ |
| 366 @Id(2) |
| 367 int get unit; |
| 368 } |
| 369 |
| 370 /** |
| 371 * Linked summary of a library. |
| 372 */ |
| 373 @TopLevel('LLib') |
| 374 abstract class LinkedLibrary extends base.SummaryClass { |
| 375 factory LinkedLibrary.fromBuffer(List<int> buffer) => |
| 376 generated.readLinkedLibrary(buffer); |
| 377 |
| 378 /** |
| 379 * The libraries that this library depends on (either via an explicit import |
| 380 * statement or via the implicit dependencies on `dart:core` and |
| 381 * `dart:async`). The first element of this array is a pseudo-dependency |
| 382 * representing the library itself (it is also used for `dynamic` and |
| 383 * `void`). This is followed by elements representing "prelinked" |
| 384 * dependencies (direct imports and the transitive closure of exports). |
| 385 * After the prelinked dependencies are elements representing "linked" |
| 386 * dependencies. |
| 387 * |
| 388 * A library is only included as a "linked" dependency if it is a true |
| 389 * dependency (e.g. a propagated or inferred type or constant value |
| 390 * implicitly refers to an element declared in the library) or |
| 391 * anti-dependency (e.g. the result of type propagation or type inference |
| 392 * depends on the lack of a certain declaration in the library). |
| 393 */ |
| 394 @Id(0) |
| 395 List<LinkedDependency> get dependencies; |
| 396 |
| 397 /** |
| 398 * For each export in [UnlinkedUnit.exports], an index into [dependencies] |
| 399 * of the library being exported. |
| 400 */ |
| 401 @Id(6) |
| 402 List<int> get exportDependencies; |
| 403 |
| 404 /** |
| 405 * Information about entities in the export namespace of the library that are |
| 406 * not in the public namespace of the library (that is, entities that are |
| 407 * brought into the namespace via `export` directives). |
| 408 * |
| 409 * Sorted by name. |
| 410 */ |
| 411 @Id(4) |
| 412 List<LinkedExportName> get exportNames; |
| 413 |
| 414 /** |
| 415 * Indicates whether this library was summarized in "fallback mode". If |
| 416 * true, all other fields in the data structure have their default values. |
| 417 */ |
| 418 @Id(5) |
| 419 bool get fallbackMode; |
| 420 |
| 421 /** |
| 422 * For each import in [UnlinkedUnit.imports], an index into [dependencies] |
| 423 * of the library being imported. |
| 424 */ |
| 425 @Id(1) |
| 426 List<int> get importDependencies; |
| 427 |
| 428 /** |
| 429 * The number of elements in [dependencies] which are not "linked" |
| 430 * dependencies (that is, the number of libraries in the direct imports plus |
| 431 * the transitive closure of exports, plus the library itself). |
| 432 */ |
| 433 @Id(2) |
| 434 int get numPrelinkedDependencies; |
| 435 |
| 436 /** |
| 437 * The linked summary of all the compilation units constituting the |
| 438 * library. The summary of the defining compilation unit is listed first, |
| 439 * followed by the summary of each part, in the order of the `part` |
| 440 * declarations in the defining compilation unit. |
| 441 */ |
| 442 @Id(3) |
| 443 List<LinkedUnit> get units; |
| 444 } |
| 445 |
| 446 /** |
| 447 * Information about the resolution of an [UnlinkedReference]. |
| 448 */ |
| 449 abstract class LinkedReference extends base.SummaryClass { |
| 450 /** |
| 451 * If this [LinkedReference] doesn't have an associated [UnlinkedReference], |
| 452 * and the entity being referred to is contained within another entity, index |
| 453 * of the containing entity. This behaves similarly to |
| 454 * [UnlinkedReference.prefixReference], however it is only used for class |
| 455 * members, not for prefixed imports. |
| 456 * |
| 457 * Containing references must always point backward; that is, for all i, if |
| 458 * LinkedUnit.references[i].containingReference != 0, then |
| 459 * LinkedUnit.references[i].containingReference < i. |
| 460 */ |
| 461 @Id(5) |
| 462 int get containingReference; |
| 463 |
| 464 /** |
| 465 * Index into [LinkedLibrary.dependencies] indicating which imported library |
| 466 * declares the entity being referred to. |
| 467 * |
| 468 * Zero if this entity is contained within another entity (e.g. a class |
| 469 * member), or if [kind] is [ReferenceKind.prefix]. |
| 470 */ |
| 471 @Id(1) |
| 472 int get dependency; |
| 473 |
| 474 /** |
| 475 * The kind of the entity being referred to. For the pseudo-types `dynamic` |
| 476 * and `void`, the kind is [ReferenceKind.classOrEnum]. |
| 477 */ |
| 478 @Id(2) |
| 479 ReferenceKind get kind; |
| 480 |
| 481 /** |
| 482 * If [kind] is [ReferenceKind.function] (that is, the entity being referred |
| 483 * to is a local function), the index of the function within |
| 484 * [UnlinkedExecutable.localFunctions]. If [kind] is |
| 485 * [ReferenceKind.variable], the index of the variable within |
| 486 * [UnlinkedExecutable.localVariables]. Otherwise zero. |
| 487 */ |
| 488 @Id(6) |
| 489 int get localIndex; |
| 490 |
| 491 /** |
| 492 * If this [LinkedReference] doesn't have an associated [UnlinkedReference], |
| 493 * name of the entity being referred to. For the pseudo-type `dynamic`, the |
| 494 * string is "dynamic". For the pseudo-type `void`, the string is "void". |
| 495 */ |
| 496 @Id(3) |
| 497 String get name; |
| 498 |
| 499 /** |
| 500 * If the entity being referred to is generic, the number of type parameters |
| 501 * it declares (does not include type parameters of enclosing entities). |
| 502 * Otherwise zero. |
| 503 */ |
| 504 @Id(4) |
| 505 int get numTypeParameters; |
| 506 |
| 507 /** |
| 508 * Integer index indicating which unit in the imported library contains the |
| 509 * definition of the entity. As with indices into [LinkedLibrary.units], |
| 510 * zero represents the defining compilation unit, and nonzero values |
| 511 * represent parts in the order of the corresponding `part` declarations. |
| 512 * |
| 513 * Zero if this entity is contained within another entity (e.g. a class |
| 514 * member). |
| 515 */ |
| 516 @Id(0) |
| 517 int get unit; |
| 518 } |
| 519 |
| 520 /** |
| 521 * Linked summary of a compilation unit. |
| 522 */ |
| 523 abstract class LinkedUnit extends base.SummaryClass { |
| 524 /** |
| 525 * List of slot ids (referring to [UnlinkedExecutable.constCycleSlot]) |
| 526 * corresponding to const constructors that are part of cycles. |
| 527 */ |
| 528 @Id(2) |
| 529 List<int> get constCycles; |
| 530 |
| 531 /** |
| 532 * List of slot ids (referring to [UnlinkedParam.inheritsCovariantSlot]) |
| 533 * corresponding to parameters that inherit `@covariant` behavior from a base |
| 534 * class. |
| 535 */ |
| 536 @Id(3) |
| 537 List<int> get parametersInheritingCovariant; |
| 538 |
| 539 /** |
| 540 * Information about the resolution of references within the compilation |
| 541 * unit. Each element of [UnlinkedUnit.references] has a corresponding |
| 542 * element in this list (at the same index). If this list has additional |
| 543 * elements beyond the number of elements in [UnlinkedUnit.references], those |
| 544 * additional elements are references that are only referred to implicitly |
| 545 * (e.g. elements involved in inferred or propagated types). |
| 546 */ |
| 547 @Id(0) |
| 548 List<LinkedReference> get references; |
| 549 |
| 550 /** |
| 551 * List associating slot ids found inside the unlinked summary for the |
| 552 * compilation unit with propagated and inferred types. |
| 553 */ |
| 554 @Id(1) |
| 555 List<EntityRef> get types; |
| 556 } |
| 557 |
| 558 /** |
| 559 * Summary information about a package. |
| 560 */ |
| 561 @TopLevel('PBdl') |
| 562 abstract class PackageBundle extends base.SummaryClass { |
| 563 factory PackageBundle.fromBuffer(List<int> buffer) => |
| 564 generated.readPackageBundle(buffer); |
| 565 |
| 566 /** |
| 567 * MD5 hash of the non-informative fields of the [PackageBundle] (not |
| 568 * including this one). This can be used to identify when the API of a |
| 569 * package may have changed. |
| 570 */ |
| 571 @Id(7) |
| 572 String get apiSignature; |
| 573 |
| 574 /** |
| 575 * Information about the packages this package depends on, if known. |
| 576 */ |
| 577 @Id(8) |
| 578 @informative |
| 579 List<PackageDependencyInfo> get dependencies; |
| 580 |
| 581 /** |
| 582 * Linked libraries. |
| 583 */ |
| 584 @Id(0) |
| 585 List<LinkedLibrary> get linkedLibraries; |
| 586 |
| 587 /** |
| 588 * The list of URIs of items in [linkedLibraries], e.g. `dart:core` or |
| 589 * `package:foo/bar.dart`. |
| 590 */ |
| 591 @Id(1) |
| 592 List<String> get linkedLibraryUris; |
| 593 |
| 594 /** |
| 595 * Major version of the summary format. See |
| 596 * [PackageBundleAssembler.currentMajorVersion]. |
| 597 */ |
| 598 @Id(5) |
| 599 int get majorVersion; |
| 600 |
| 601 /** |
| 602 * Minor version of the summary format. See |
| 603 * [PackageBundleAssembler.currentMinorVersion]. |
| 604 */ |
| 605 @Id(6) |
| 606 int get minorVersion; |
| 607 |
| 608 /** |
| 609 * List of MD5 hashes of the files listed in [unlinkedUnitUris]. Each hash |
| 610 * is encoded as a hexadecimal string using lower case letters. |
| 611 */ |
| 612 @Id(4) |
| 613 @informative |
| 614 List<String> get unlinkedUnitHashes; |
| 615 |
| 616 /** |
| 617 * Unlinked information for the compilation units constituting the package. |
| 618 */ |
| 619 @Id(2) |
| 620 List<UnlinkedUnit> get unlinkedUnits; |
| 621 |
| 622 /** |
| 623 * The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`. |
| 624 */ |
| 625 @Id(3) |
| 626 List<String> get unlinkedUnitUris; |
| 627 } |
| 628 |
| 629 /** |
| 630 * Information about a single dependency of a summary package. |
| 631 */ |
| 632 abstract class PackageDependencyInfo extends base.SummaryClass { |
| 633 /** |
| 634 * API signature of this dependency. |
| 635 */ |
| 636 @Id(0) |
| 637 String get apiSignature; |
| 638 |
| 639 /** |
| 640 * If this dependency summarizes any files whose URI takes the form |
| 641 * "package:<package_name>/...", a list of all such package names, sorted |
| 642 * lexicographically. Otherwise empty. |
| 643 */ |
| 644 @Id(2) |
| 645 List<String> get includedPackageNames; |
| 646 |
| 647 /** |
| 648 * Indicates whether this dependency summarizes any files whose URI takes the |
| 649 * form "dart:...". |
| 650 */ |
| 651 @Id(4) |
| 652 bool get includesDartUris; |
| 653 |
| 654 /** |
| 655 * Indicates whether this dependency summarizes any files whose URI takes the |
| 656 * form "file:...". |
| 657 */ |
| 658 @Id(3) |
| 659 bool get includesFileUris; |
| 660 |
| 661 /** |
| 662 * Relative path to the summary file for this dependency. This is intended as |
| 663 * a hint to help the analysis server locate summaries of dependencies. We |
| 664 * don't specify precisely what this path is relative to, but we expect it to |
| 665 * be relative to a directory the analysis server can find (e.g. for projects |
| 666 * built using Bazel, it would be relative to the "bazel-bin" directory). |
| 667 * |
| 668 * Absent if the path is not known. |
| 669 */ |
| 670 @Id(1) |
| 671 String get summaryPath; |
| 672 } |
| 673 |
| 674 /** |
| 675 * Index information about a package. |
| 676 */ |
| 677 @TopLevel('Indx') |
| 678 abstract class PackageIndex extends base.SummaryClass { |
| 679 factory PackageIndex.fromBuffer(List<int> buffer) => |
| 680 generated.readPackageIndex(buffer); |
| 681 |
| 682 /** |
| 683 * Each item of this list corresponds to a unique referenced element. It is |
| 684 * the kind of the synthetic element. |
| 685 */ |
| 686 @Id(5) |
| 687 List<IndexSyntheticElementKind> get elementKinds; |
| 688 |
| 689 /** |
| 690 * Each item of this list corresponds to a unique referenced element. It is |
| 691 * the identifier of the class member element name, or `null` if the element i
s |
| 692 * a top-level element. The list is sorted in ascending order, so that the |
| 693 * client can quickly check whether an element is referenced in this |
| 694 * [PackageIndex]. |
| 695 */ |
| 696 @Id(7) |
| 697 List<int> get elementNameClassMemberIds; |
| 698 |
| 699 /** |
| 700 * Each item of this list corresponds to a unique referenced element. It is |
| 701 * the identifier of the named parameter name, or `null` if the element is not |
| 702 * a named parameter. The list is sorted in ascending order, so that the |
| 703 * client can quickly check whether an element is referenced in this |
| 704 * [PackageIndex]. |
| 705 */ |
| 706 @Id(8) |
| 707 List<int> get elementNameParameterIds; |
| 708 |
| 709 /** |
| 710 * Each item of this list corresponds to a unique referenced element. It is |
| 711 * the identifier of the top-level element name, or `null` if the element is |
| 712 * the unit. The list is sorted in ascending order, so that the client can |
| 713 * quickly check whether an element is referenced in this [PackageIndex]. |
| 714 */ |
| 715 @Id(1) |
| 716 List<int> get elementNameUnitMemberIds; |
| 717 |
| 718 /** |
| 719 * Each item of this list corresponds to a unique referenced element. It is |
| 720 * the index into [unitLibraryUris] and [unitUnitUris] for the library |
| 721 * specific unit where the element is declared. |
| 722 */ |
| 723 @Id(0) |
| 724 List<int> get elementUnits; |
| 725 |
| 726 /** |
| 727 * List of unique element strings used in this [PackageIndex]. The list is |
| 728 * sorted in ascending order, so that the client can quickly check the |
| 729 * presence of a string in this [PackageIndex]. |
| 730 */ |
| 731 @Id(6) |
| 732 List<String> get strings; |
| 733 |
| 734 /** |
| 735 * Each item of this list corresponds to the library URI of a unique library |
| 736 * specific unit referenced in the [PackageIndex]. It is an index into |
| 737 * [strings] list. |
| 738 */ |
| 739 @Id(2) |
| 740 List<int> get unitLibraryUris; |
| 741 |
| 742 /** |
| 743 * List of indexes of each unit in this [PackageIndex]. |
| 744 */ |
| 745 @Id(4) |
| 746 List<UnitIndex> get units; |
| 747 |
| 748 /** |
| 749 * Each item of this list corresponds to the unit URI of a unique library |
| 750 * specific unit referenced in the [PackageIndex]. It is an index into |
| 751 * [strings] list. |
| 752 */ |
| 753 @Id(3) |
| 754 List<int> get unitUnitUris; |
| 755 } |
| 756 |
| 757 /** |
| 758 * Enum used to indicate the kind of entity referred to by a |
| 759 * [LinkedReference]. |
| 760 */ |
| 761 enum ReferenceKind { |
| 762 /** |
| 763 * The entity is a class or enum. |
| 764 */ |
| 765 classOrEnum, |
| 766 |
| 767 /** |
| 768 * The entity is a constructor. |
| 769 */ |
| 770 constructor, |
| 771 |
| 772 /** |
| 773 * The entity is a getter or setter inside a class. Note: this is used in |
| 774 * the case where a constant refers to a static const declared inside a |
| 775 * class. |
| 776 */ |
| 777 propertyAccessor, |
| 778 |
| 779 /** |
| 780 * The entity is a method. |
| 781 */ |
| 782 method, |
| 783 |
| 784 /** |
| 785 * The entity is a typedef. |
| 786 */ |
| 787 typedef, |
| 788 |
| 789 /** |
| 790 * The entity is a local function. |
| 791 */ |
| 792 function, |
| 793 |
| 794 /** |
| 795 * The entity is a local variable. |
| 796 */ |
| 797 variable, |
| 798 |
| 799 /** |
| 800 * The entity is a top level function. |
| 801 */ |
| 802 topLevelFunction, |
| 803 |
| 804 /** |
| 805 * The entity is a top level getter or setter. |
| 806 */ |
| 807 topLevelPropertyAccessor, |
| 808 |
| 809 /** |
| 810 * The entity is a prefix. |
| 811 */ |
| 812 prefix, |
| 813 |
| 814 /** |
| 815 * The entity being referred to does not exist. |
| 816 */ |
| 817 unresolved |
| 818 } |
| 819 |
| 820 /** |
| 821 * Index information about a unit in a [PackageIndex]. |
| 822 */ |
| 823 abstract class UnitIndex extends base.SummaryClass { |
| 824 /** |
| 825 * Each item of this list is the kind of an element defined in this unit. |
| 826 */ |
| 827 @Id(6) |
| 828 List<IndexNameKind> get definedNameKinds; |
| 829 |
| 830 /** |
| 831 * Each item of this list is the name offset of an element defined in this |
| 832 * unit relative to the beginning of the file. |
| 833 */ |
| 834 @Id(7) |
| 835 List<int> get definedNameOffsets; |
| 836 |
| 837 /** |
| 838 * Each item of this list corresponds to an element defined in this unit. It |
| 839 * is an index into [PackageIndex.strings] list. The list is sorted in |
| 840 * ascending order, so that the client can quickly find name definitions in |
| 841 * this [UnitIndex]. |
| 842 */ |
| 843 @Id(5) |
| 844 List<int> get definedNames; |
| 845 |
| 846 /** |
| 847 * Index into [PackageIndex.unitLibraryUris] and [PackageIndex.unitUnitUris] |
| 848 * for the library specific unit that corresponds to this [UnitIndex]. |
| 849 */ |
| 850 @Id(0) |
| 851 int get unit; |
| 852 |
| 853 /** |
| 854 * Each item of this list is the `true` if the corresponding element usage |
| 855 * is qualified with some prefix. |
| 856 */ |
| 857 @Id(11) |
| 858 List<bool> get usedElementIsQualifiedFlags; |
| 859 |
| 860 /** |
| 861 * Each item of this list is the kind of the element usage. |
| 862 */ |
| 863 @Id(4) |
| 864 List<IndexRelationKind> get usedElementKinds; |
| 865 |
| 866 /** |
| 867 * Each item of this list is the length of the element usage. |
| 868 */ |
| 869 @Id(1) |
| 870 List<int> get usedElementLengths; |
| 871 |
| 872 /** |
| 873 * Each item of this list is the offset of the element usage relative to the |
| 874 * beginning of the file. |
| 875 */ |
| 876 @Id(2) |
| 877 List<int> get usedElementOffsets; |
| 878 |
| 879 /** |
| 880 * Each item of this list is the index into [PackageIndex.elementUnits] and |
| 881 * [PackageIndex.elementOffsets]. The list is sorted in ascending order, so |
| 882 * that the client can quickly find element references in this [UnitIndex]. |
| 883 */ |
| 884 @Id(3) |
| 885 List<int> get usedElements; |
| 886 |
| 887 /** |
| 888 * Each item of this list is the `true` if the corresponding name usage |
| 889 * is qualified with some prefix. |
| 890 */ |
| 891 @Id(12) |
| 892 List<bool> get usedNameIsQualifiedFlags; |
| 893 |
| 894 /** |
| 895 * Each item of this list is the kind of the name usage. |
| 896 */ |
| 897 @Id(10) |
| 898 List<IndexRelationKind> get usedNameKinds; |
| 899 |
| 900 /** |
| 901 * Each item of this list is the offset of the name usage relative to the |
| 902 * beginning of the file. |
| 903 */ |
| 904 @Id(9) |
| 905 List<int> get usedNameOffsets; |
| 906 |
| 907 /** |
| 908 * Each item of this list is the index into [PackageIndex.strings] for a |
| 909 * used name. The list is sorted in ascending order, so that the client can |
| 910 * quickly find name uses in this [UnitIndex]. |
| 911 */ |
| 912 @Id(8) |
| 913 List<int> get usedNames; |
| 914 } |
| 915 |
| 916 /** |
| 917 * Unlinked summary information about a class declaration. |
| 918 */ |
| 919 abstract class UnlinkedClass extends base.SummaryClass { |
| 920 /** |
| 921 * Annotations for this class. |
| 922 */ |
| 923 @Id(5) |
| 924 List<UnlinkedConst> get annotations; |
| 925 |
| 926 /** |
| 927 * Code range of the class. |
| 928 */ |
| 929 @informative |
| 930 @Id(13) |
| 931 CodeRange get codeRange; |
| 932 |
| 933 /** |
| 934 * Documentation comment for the class, or `null` if there is no |
| 935 * documentation comment. |
| 936 */ |
| 937 @informative |
| 938 @Id(6) |
| 939 UnlinkedDocumentationComment get documentationComment; |
| 940 |
| 941 /** |
| 942 * Executable objects (methods, getters, and setters) contained in the class. |
| 943 */ |
| 944 @Id(2) |
| 945 List<UnlinkedExecutable> get executables; |
| 946 |
| 947 /** |
| 948 * Field declarations contained in the class. |
| 949 */ |
| 950 @Id(4) |
| 951 List<UnlinkedVariable> get fields; |
| 952 |
| 953 /** |
| 954 * Indicates whether this class is the core "Object" class (and hence has no |
| 955 * supertype) |
| 956 */ |
| 957 @Id(12) |
| 958 bool get hasNoSupertype; |
| 959 |
| 960 /** |
| 961 * Interfaces appearing in an `implements` clause, if any. |
| 962 */ |
| 963 @Id(7) |
| 964 List<EntityRef> get interfaces; |
| 965 |
| 966 /** |
| 967 * Indicates whether the class is declared with the `abstract` keyword. |
| 968 */ |
| 969 @Id(8) |
| 970 bool get isAbstract; |
| 971 |
| 972 /** |
| 973 * Indicates whether the class is declared using mixin application syntax. |
| 974 */ |
| 975 @Id(11) |
| 976 bool get isMixinApplication; |
| 977 |
| 978 /** |
| 979 * Mixins appearing in a `with` clause, if any. |
| 980 */ |
| 981 @Id(10) |
| 982 List<EntityRef> get mixins; |
| 983 |
| 984 /** |
| 985 * Name of the class. |
| 986 */ |
| 987 @Id(0) |
| 988 String get name; |
| 989 |
| 990 /** |
| 991 * Offset of the class name relative to the beginning of the file. |
| 992 */ |
| 993 @informative |
| 994 @Id(1) |
| 995 int get nameOffset; |
| 996 |
| 997 /** |
| 998 * Supertype of the class, or `null` if either (a) the class doesn't |
| 999 * explicitly declare a supertype (and hence has supertype `Object`), or (b) |
| 1000 * the class *is* `Object` (and hence has no supertype). |
| 1001 */ |
| 1002 @Id(3) |
| 1003 EntityRef get supertype; |
| 1004 |
| 1005 /** |
| 1006 * Type parameters of the class, if any. |
| 1007 */ |
| 1008 @Id(9) |
| 1009 List<UnlinkedTypeParam> get typeParameters; |
| 1010 } |
| 1011 |
| 1012 /** |
| 1013 * Unlinked summary information about a `show` or `hide` combinator in an |
| 1014 * import or export declaration. |
| 1015 */ |
| 1016 abstract class UnlinkedCombinator extends base.SummaryClass { |
| 1017 /** |
| 1018 * If this is a `show` combinator, offset of the end of the list of shown |
| 1019 * names. Otherwise zero. |
| 1020 */ |
| 1021 @informative |
| 1022 @Id(3) |
| 1023 int get end; |
| 1024 |
| 1025 /** |
| 1026 * List of names which are hidden. Empty if this is a `show` combinator. |
| 1027 */ |
| 1028 @Id(1) |
| 1029 List<String> get hides; |
| 1030 |
| 1031 /** |
| 1032 * If this is a `show` combinator, offset of the `show` keyword. Otherwise |
| 1033 * zero. |
| 1034 */ |
| 1035 @informative |
| 1036 @Id(2) |
| 1037 int get offset; |
| 1038 |
| 1039 /** |
| 1040 * List of names which are shown. Empty if this is a `hide` combinator. |
| 1041 */ |
| 1042 @Id(0) |
| 1043 List<String> get shows; |
| 1044 } |
| 1045 |
| 1046 /** |
| 1047 * Unlinked summary information about a single import or export configuration. |
| 1048 */ |
| 1049 abstract class UnlinkedConfiguration extends base.SummaryClass { |
| 1050 /** |
| 1051 * The name of the declared variable whose value is being used in the |
| 1052 * condition. |
| 1053 */ |
| 1054 @Id(0) |
| 1055 String get name; |
| 1056 |
| 1057 /** |
| 1058 * The URI of the implementation library to be used if the condition is true. |
| 1059 */ |
| 1060 @Id(2) |
| 1061 String get uri; |
| 1062 |
| 1063 /** |
| 1064 * The value to which the value of the declared variable will be compared, |
| 1065 * or `true` if the condition does not include an equality test. |
| 1066 */ |
| 1067 @Id(1) |
| 1068 String get value; |
| 1069 } |
| 1070 |
| 1071 /** |
| 1072 * Unlinked summary information about a compile-time constant expression, or a |
| 1073 * potentially constant expression. |
| 1074 * |
| 1075 * Constant expressions are represented using a simple stack-based language |
| 1076 * where [operations] is a sequence of operations to execute starting with an |
| 1077 * empty stack. Once all operations have been executed, the stack should |
| 1078 * contain a single value which is the value of the constant. Note that some |
| 1079 * operations consume additional data from the other fields of this class. |
| 1080 */ |
| 1081 abstract class UnlinkedConst extends base.SummaryClass { |
| 1082 /** |
| 1083 * Sequence of operators used by assignment operations. |
| 1084 */ |
| 1085 @Id(6) |
| 1086 List<UnlinkedExprAssignOperator> get assignmentOperators; |
| 1087 |
| 1088 /** |
| 1089 * Sequence of 64-bit doubles consumed by the operation `pushDouble`. |
| 1090 */ |
| 1091 @Id(4) |
| 1092 List<double> get doubles; |
| 1093 |
| 1094 /** |
| 1095 * Sequence of unsigned 32-bit integers consumed by the operations |
| 1096 * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`, |
| 1097 * `makeList`, and `makeMap`. |
| 1098 */ |
| 1099 @Id(1) |
| 1100 List<int> get ints; |
| 1101 |
| 1102 /** |
| 1103 * Indicates whether the expression is a valid potentially constant |
| 1104 * expression. |
| 1105 */ |
| 1106 @Id(5) |
| 1107 bool get isValidConst; |
| 1108 |
| 1109 /** |
| 1110 * Sequence of operations to execute (starting with an empty stack) to form |
| 1111 * the constant value. |
| 1112 */ |
| 1113 @Id(0) |
| 1114 List<UnlinkedConstOperation> get operations; |
| 1115 |
| 1116 /** |
| 1117 * Sequence of language constructs consumed by the operations |
| 1118 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note |
| 1119 * that in the case of `pushReference` (and sometimes `invokeConstructor` the |
| 1120 * actual entity being referred to may be something other than a type. |
| 1121 */ |
| 1122 @Id(2) |
| 1123 List<EntityRef> get references; |
| 1124 |
| 1125 /** |
| 1126 * Sequence of strings consumed by the operations `pushString` and |
| 1127 * `invokeConstructor`. |
| 1128 */ |
| 1129 @Id(3) |
| 1130 List<String> get strings; |
| 1131 } |
| 1132 |
| 1133 /** |
| 1134 * Enum representing the various kinds of operations which may be performed to |
| 1135 * produce a constant value. These options are assumed to execute in the |
| 1136 * context of a stack which is initially empty. |
| 1137 */ |
| 1138 enum UnlinkedConstOperation { |
| 1139 /** |
| 1140 * Push the next value from [UnlinkedConst.ints] (a 32-bit unsigned integer) |
| 1141 * onto the stack. |
| 1142 * |
| 1143 * Note that Dart supports integers larger than 32 bits; these are |
| 1144 * represented by composing 32-bit values using the [pushLongInt] operation. |
| 1145 */ |
| 1146 pushInt, |
| 1147 |
| 1148 /** |
| 1149 * Get the number of components from [UnlinkedConst.ints], then do this number |
| 1150 * of times the following operations: multiple the current value by 2^32, "or" |
| 1151 * it with the next value in [UnlinkedConst.ints]. The initial value is zero. |
| 1152 * Push the result into the stack. |
| 1153 */ |
| 1154 pushLongInt, |
| 1155 |
| 1156 /** |
| 1157 * Push the next value from [UnlinkedConst.doubles] (a double precision |
| 1158 * floating point value) onto the stack. |
| 1159 */ |
| 1160 pushDouble, |
| 1161 |
| 1162 /** |
| 1163 * Push the constant `true` onto the stack. |
| 1164 */ |
| 1165 pushTrue, |
| 1166 |
| 1167 /** |
| 1168 * Push the constant `false` onto the stack. |
| 1169 */ |
| 1170 pushFalse, |
| 1171 |
| 1172 /** |
| 1173 * Push the next value from [UnlinkedConst.strings] onto the stack. |
| 1174 */ |
| 1175 pushString, |
| 1176 |
| 1177 /** |
| 1178 * Pop the top n values from the stack (where n is obtained from |
| 1179 * [UnlinkedConst.ints]), convert them to strings (if they aren't already), |
| 1180 * concatenate them into a single string, and push it back onto the stack. |
| 1181 * |
| 1182 * This operation is used to represent constants whose value is a literal |
| 1183 * string containing string interpolations. |
| 1184 */ |
| 1185 concatenate, |
| 1186 |
| 1187 /** |
| 1188 * Get the next value from [UnlinkedConst.strings], convert it to a symbol, |
| 1189 * and push it onto the stack. |
| 1190 */ |
| 1191 makeSymbol, |
| 1192 |
| 1193 /** |
| 1194 * Push the constant `null` onto the stack. |
| 1195 */ |
| 1196 pushNull, |
| 1197 |
| 1198 /** |
| 1199 * Push the value of the function parameter with the name obtained from |
| 1200 * [UnlinkedConst.strings]. |
| 1201 */ |
| 1202 pushParameter, |
| 1203 |
| 1204 /** |
| 1205 * Evaluate a (potentially qualified) identifier expression and push the |
| 1206 * resulting value onto the stack. The identifier to be evaluated is |
| 1207 * obtained from [UnlinkedConst.references]. |
| 1208 * |
| 1209 * This operation is used to represent the following kinds of constants |
| 1210 * (which are indistinguishable from an unresolved AST alone): |
| 1211 * |
| 1212 * - A qualified reference to a static constant variable (e.g. `C.v`, where |
| 1213 * C is a class and `v` is a constant static variable in `C`). |
| 1214 * - An identifier expression referring to a constant variable. |
| 1215 * - A simple or qualified identifier denoting a class or type alias. |
| 1216 * - A simple or qualified identifier denoting a top-level function or a |
| 1217 * static method. |
| 1218 */ |
| 1219 pushReference, |
| 1220 |
| 1221 /** |
| 1222 * Pop the top value from the stack, extract the value of the property with |
| 1223 * the name obtained from [UnlinkedConst.strings], and push the result back |
| 1224 * onto the stack. |
| 1225 */ |
| 1226 extractProperty, |
| 1227 |
| 1228 /** |
| 1229 * Pop the top `n` values from the stack (where `n` is obtained from |
| 1230 * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
| 1231 * `n` values from [UnlinkedConst.strings] and use the lists of names and |
| 1232 * values to create named arguments. Then pop the top `m` values from the |
| 1233 * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
| 1234 * from the end) and use them as positional arguments. Use the lists of |
| 1235 * positional and names arguments to invoke a constant constructor obtained |
| 1236 * from [UnlinkedConst.references], and push the resulting value back onto the |
| 1237 * stack. |
| 1238 * |
| 1239 * Note that for an invocation of the form `const a.b(...)` (where no type |
| 1240 * arguments are specified), it is impossible to tell from the unresolved AST |
| 1241 * alone whether `a` is a class name and `b` is a constructor name, or `a` is |
| 1242 * a prefix name and `b` is a class name. For consistency between AST based |
| 1243 * and elements based summaries, references to default constructors are always |
| 1244 * recorded as references to corresponding classes. |
| 1245 */ |
| 1246 invokeConstructor, |
| 1247 |
| 1248 /** |
| 1249 * Pop the top n values from the stack (where n is obtained from |
| 1250 * [UnlinkedConst.ints]), place them in a [List], and push the result back |
| 1251 * onto the stack. The type parameter for the [List] is implicitly `dynamic`. |
| 1252 */ |
| 1253 makeUntypedList, |
| 1254 |
| 1255 /** |
| 1256 * Pop the top 2*n values from the stack (where n is obtained from |
| 1257 * [UnlinkedConst.ints]), interpret them as key/value pairs, place them in a |
| 1258 * [Map], and push the result back onto the stack. The two type parameters |
| 1259 * for the [Map] are implicitly `dynamic`. |
| 1260 */ |
| 1261 makeUntypedMap, |
| 1262 |
| 1263 /** |
| 1264 * Pop the top n values from the stack (where n is obtained from |
| 1265 * [UnlinkedConst.ints]), place them in a [List], and push the result back |
| 1266 * onto the stack. The type parameter for the [List] is obtained from |
| 1267 * [UnlinkedConst.references]. |
| 1268 */ |
| 1269 makeTypedList, |
| 1270 |
| 1271 /** |
| 1272 * Pop the top 2*n values from the stack (where n is obtained from |
| 1273 * [UnlinkedConst.ints]), interpret them as key/value pairs, place them in a |
| 1274 * [Map], and push the result back onto the stack. The two type parameters fo
r |
| 1275 * the [Map] are obtained from [UnlinkedConst.references]. |
| 1276 */ |
| 1277 makeTypedMap, |
| 1278 |
| 1279 /** |
| 1280 * Pop the top 2 values from the stack, evaluate `v1 == v2`, and push the |
| 1281 * result back onto the stack. |
| 1282 */ |
| 1283 equal, |
| 1284 |
| 1285 /** |
| 1286 * Pop the top 2 values from the stack, evaluate `v1 != v2`, and push the |
| 1287 * result back onto the stack. |
| 1288 */ |
| 1289 notEqual, |
| 1290 |
| 1291 /** |
| 1292 * Pop the top value from the stack, compute its boolean negation, and push |
| 1293 * the result back onto the stack. |
| 1294 */ |
| 1295 not, |
| 1296 |
| 1297 /** |
| 1298 * Pop the top 2 values from the stack, compute `v1 && v2`, and push the |
| 1299 * result back onto the stack. |
| 1300 */ |
| 1301 and, |
| 1302 |
| 1303 /** |
| 1304 * Pop the top 2 values from the stack, compute `v1 || v2`, and push the |
| 1305 * result back onto the stack. |
| 1306 */ |
| 1307 or, |
| 1308 |
| 1309 /** |
| 1310 * Pop the top value from the stack, compute its integer complement, and push |
| 1311 * the result back onto the stack. |
| 1312 */ |
| 1313 complement, |
| 1314 |
| 1315 /** |
| 1316 * Pop the top 2 values from the stack, compute `v1 ^ v2`, and push the |
| 1317 * result back onto the stack. |
| 1318 */ |
| 1319 bitXor, |
| 1320 |
| 1321 /** |
| 1322 * Pop the top 2 values from the stack, compute `v1 & v2`, and push the |
| 1323 * result back onto the stack. |
| 1324 */ |
| 1325 bitAnd, |
| 1326 |
| 1327 /** |
| 1328 * Pop the top 2 values from the stack, compute `v1 | v2`, and push the |
| 1329 * result back onto the stack. |
| 1330 */ |
| 1331 bitOr, |
| 1332 |
| 1333 /** |
| 1334 * Pop the top 2 values from the stack, compute `v1 >> v2`, and push the |
| 1335 * result back onto the stack. |
| 1336 */ |
| 1337 bitShiftRight, |
| 1338 |
| 1339 /** |
| 1340 * Pop the top 2 values from the stack, compute `v1 << v2`, and push the |
| 1341 * result back onto the stack. |
| 1342 */ |
| 1343 bitShiftLeft, |
| 1344 |
| 1345 /** |
| 1346 * Pop the top 2 values from the stack, compute `v1 + v2`, and push the |
| 1347 * result back onto the stack. |
| 1348 */ |
| 1349 add, |
| 1350 |
| 1351 /** |
| 1352 * Pop the top value from the stack, compute its integer negation, and push |
| 1353 * the result back onto the stack. |
| 1354 */ |
| 1355 negate, |
| 1356 |
| 1357 /** |
| 1358 * Pop the top 2 values from the stack, compute `v1 - v2`, and push the |
| 1359 * result back onto the stack. |
| 1360 */ |
| 1361 subtract, |
| 1362 |
| 1363 /** |
| 1364 * Pop the top 2 values from the stack, compute `v1 * v2`, and push the |
| 1365 * result back onto the stack. |
| 1366 */ |
| 1367 multiply, |
| 1368 |
| 1369 /** |
| 1370 * Pop the top 2 values from the stack, compute `v1 / v2`, and push the |
| 1371 * result back onto the stack. |
| 1372 */ |
| 1373 divide, |
| 1374 |
| 1375 /** |
| 1376 * Pop the top 2 values from the stack, compute `v1 ~/ v2`, and push the |
| 1377 * result back onto the stack. |
| 1378 */ |
| 1379 floorDivide, |
| 1380 |
| 1381 /** |
| 1382 * Pop the top 2 values from the stack, compute `v1 > v2`, and push the |
| 1383 * result back onto the stack. |
| 1384 */ |
| 1385 greater, |
| 1386 |
| 1387 /** |
| 1388 * Pop the top 2 values from the stack, compute `v1 < v2`, and push the |
| 1389 * result back onto the stack. |
| 1390 */ |
| 1391 less, |
| 1392 |
| 1393 /** |
| 1394 * Pop the top 2 values from the stack, compute `v1 >= v2`, and push the |
| 1395 * result back onto the stack. |
| 1396 */ |
| 1397 greaterEqual, |
| 1398 |
| 1399 /** |
| 1400 * Pop the top 2 values from the stack, compute `v1 <= v2`, and push the |
| 1401 * result back onto the stack. |
| 1402 */ |
| 1403 lessEqual, |
| 1404 |
| 1405 /** |
| 1406 * Pop the top 2 values from the stack, compute `v1 % v2`, and push the |
| 1407 * result back onto the stack. |
| 1408 */ |
| 1409 modulo, |
| 1410 |
| 1411 /** |
| 1412 * Pop the top 3 values from the stack, compute `v1 ? v2 : v3`, and push the |
| 1413 * result back onto the stack. |
| 1414 */ |
| 1415 conditional, |
| 1416 |
| 1417 /** |
| 1418 * Pop from the stack `value` and get the next `target` reference from |
| 1419 * [UnlinkedConst.references] - a top-level variable (prefixed or not), an |
| 1420 * assignable field of a class (prefixed or not), or a sequence of getters |
| 1421 * ending with an assignable property `a.b.b.c.d.e`. In general `a.b` cannot |
| 1422 * not be distinguished between: `a` is a prefix and `b` is a top-level |
| 1423 * variable; or `a` is an object and `b` is the name of a property. Perform |
| 1424 * `reference op= value` where `op` is the next assignment operator from |
| 1425 * [UnlinkedConst.assignmentOperators]. Push `value` back into the stack. |
| 1426 * |
| 1427 * If the assignment operator is a prefix/postfix increment/decrement, then |
| 1428 * `value` is not present in the stack, so it should not be popped and the |
| 1429 * corresponding value of the `target` after/before update is pushed into the |
| 1430 * stack instead. |
| 1431 */ |
| 1432 assignToRef, |
| 1433 |
| 1434 /** |
| 1435 * Pop from the stack `target` and `value`. Get the name of the property from |
| 1436 * `UnlinkedConst.strings` and assign the `value` to the named property of the |
| 1437 * `target`. This operation is used when we know that the `target` is an |
| 1438 * object reference expression, e.g. `new Foo().a.b.c` or `a.b[0].c.d`. |
| 1439 * Perform `target.property op= value` where `op` is the next assignment |
| 1440 * operator from [UnlinkedConst.assignmentOperators]. Push `value` back into |
| 1441 * the stack. |
| 1442 * |
| 1443 * If the assignment operator is a prefix/postfix increment/decrement, then |
| 1444 * `value` is not present in the stack, so it should not be popped and the |
| 1445 * corresponding value of the `target` after/before update is pushed into the |
| 1446 * stack instead. |
| 1447 */ |
| 1448 assignToProperty, |
| 1449 |
| 1450 /** |
| 1451 * Pop from the stack `index`, `target` and `value`. Perform |
| 1452 * `target[index] op= value` where `op` is the next assignment operator from |
| 1453 * [UnlinkedConst.assignmentOperators]. Push `value` back into the stack. |
| 1454 * |
| 1455 * If the assignment operator is a prefix/postfix increment/decrement, then |
| 1456 * `value` is not present in the stack, so it should not be popped and the |
| 1457 * corresponding value of the `target` after/before update is pushed into the |
| 1458 * stack instead. |
| 1459 */ |
| 1460 assignToIndex, |
| 1461 |
| 1462 /** |
| 1463 * Pop from the stack `index` and `target`. Push into the stack the result |
| 1464 * of evaluation of `target[index]`. |
| 1465 */ |
| 1466 extractIndex, |
| 1467 |
| 1468 /** |
| 1469 * Pop the top `n` values from the stack (where `n` is obtained from |
| 1470 * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
| 1471 * `n` values from [UnlinkedConst.strings] and use the lists of names and |
| 1472 * values to create named arguments. Then pop the top `m` values from the |
| 1473 * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
| 1474 * from the end) and use them as positional arguments. Use the lists of |
| 1475 * positional and names arguments to invoke a method (or a function) with |
| 1476 * the reference from [UnlinkedConst.references]. If `k` is nonzero (where |
| 1477 * `k` is obtained from [UnlinkedConst.ints]), obtain `k` type arguments from |
| 1478 * [UnlinkedConst.references] and use them as generic type arguments for the |
| 1479 * aforementioned method or function. Push the result of the invocation onto |
| 1480 * the stack. |
| 1481 * |
| 1482 * In general `a.b` cannot not be distinguished between: `a` is a prefix and |
| 1483 * `b` is a top-level function; or `a` is an object and `b` is the name of a |
| 1484 * method. This operation should be used for a sequence of identifiers |
| 1485 * `a.b.b.c.d.e` ending with an invokable result. |
| 1486 */ |
| 1487 invokeMethodRef, |
| 1488 |
| 1489 /** |
| 1490 * Pop the top `n` values from the stack (where `n` is obtained from |
| 1491 * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
| 1492 * `n` values from [UnlinkedConst.strings] and use the lists of names and |
| 1493 * values to create named arguments. Then pop the top `m` values from the |
| 1494 * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
| 1495 * from the end) and use them as positional arguments. Use the lists of |
| 1496 * positional and names arguments to invoke the method with the name from |
| 1497 * [UnlinkedConst.strings] of the target popped from the stack. If `k` is |
| 1498 * nonzero (where `k` is obtained from [UnlinkedConst.ints]), obtain `k` type |
| 1499 * arguments from [UnlinkedConst.references] and use them as generic type |
| 1500 * arguments for the aforementioned method. Push the result of the |
| 1501 * invocation onto the stack. |
| 1502 * |
| 1503 * This operation should be used for invocation of a method invocation |
| 1504 * where `target` is known to be an object instance. |
| 1505 */ |
| 1506 invokeMethod, |
| 1507 |
| 1508 /** |
| 1509 * Begin a new cascade section. Duplicate the top value of the stack. |
| 1510 */ |
| 1511 cascadeSectionBegin, |
| 1512 |
| 1513 /** |
| 1514 * End a new cascade section. Pop the top value from the stack and throw it |
| 1515 * away. |
| 1516 */ |
| 1517 cascadeSectionEnd, |
| 1518 |
| 1519 /** |
| 1520 * Pop the top value from the stack and cast it to the type with reference |
| 1521 * from [UnlinkedConst.references], push the result into the stack. |
| 1522 */ |
| 1523 typeCast, |
| 1524 |
| 1525 /** |
| 1526 * Pop the top value from the stack and check whether it is a subclass of the |
| 1527 * type with reference from [UnlinkedConst.references], push the result into |
| 1528 * the stack. |
| 1529 */ |
| 1530 typeCheck, |
| 1531 |
| 1532 /** |
| 1533 * Pop the top value from the stack and raise an exception with this value. |
| 1534 */ |
| 1535 throwException, |
| 1536 |
| 1537 /** |
| 1538 * Obtain two values `n` and `m` from [UnlinkedConst.ints]. Then, starting at |
| 1539 * the executable element for the expression being evaluated, if n > 0, pop to |
| 1540 * the nth enclosing function element. Then, push the mth local function of |
| 1541 * that element onto the stack. |
| 1542 */ |
| 1543 pushLocalFunctionReference, |
| 1544 } |
| 1545 |
| 1546 /** |
| 1547 * Unlinked summary information about a constructor initializer. |
| 1548 */ |
| 1549 abstract class UnlinkedConstructorInitializer extends base.SummaryClass { |
| 1550 /** |
| 1551 * If there are `m` [arguments] and `n` [argumentNames], then each argument |
| 1552 * from [arguments] with index `i` such that `n + i - m >= 0`, should be used |
| 1553 * with the name at `n + i - m`. |
| 1554 */ |
| 1555 @Id(4) |
| 1556 List<String> get argumentNames; |
| 1557 |
| 1558 /** |
| 1559 * If [kind] is `thisInvocation` or `superInvocation`, the arguments of the |
| 1560 * invocation. Otherwise empty. |
| 1561 */ |
| 1562 @Id(3) |
| 1563 List<UnlinkedConst> get arguments; |
| 1564 |
| 1565 /** |
| 1566 * If [kind] is `field`, the expression of the field initializer. |
| 1567 * Otherwise `null`. |
| 1568 */ |
| 1569 @Id(1) |
| 1570 UnlinkedConst get expression; |
| 1571 |
| 1572 /** |
| 1573 * The kind of the constructor initializer (field, redirect, super). |
| 1574 */ |
| 1575 @Id(2) |
| 1576 UnlinkedConstructorInitializerKind get kind; |
| 1577 |
| 1578 /** |
| 1579 * If [kind] is `field`, the name of the field declared in the class. If |
| 1580 * [kind] is `thisInvocation`, the name of the constructor, declared in this |
| 1581 * class, to redirect to. If [kind] is `superInvocation`, the name of the |
| 1582 * constructor, declared in the superclass, to invoke. |
| 1583 */ |
| 1584 @Id(0) |
| 1585 String get name; |
| 1586 } |
| 1587 |
| 1588 /** |
| 1589 * Enum used to indicate the kind of an constructor initializer. |
| 1590 */ |
| 1591 enum UnlinkedConstructorInitializerKind { |
| 1592 /** |
| 1593 * Initialization of a field. |
| 1594 */ |
| 1595 field, |
| 1596 |
| 1597 /** |
| 1598 * Invocation of a constructor in the same class. |
| 1599 */ |
| 1600 thisInvocation, |
| 1601 |
| 1602 /** |
| 1603 * Invocation of a superclass' constructor. |
| 1604 */ |
| 1605 superInvocation |
| 1606 } |
| 1607 |
| 1608 /** |
| 1609 * Unlinked summary information about a documentation comment. |
| 1610 */ |
| 1611 abstract class UnlinkedDocumentationComment extends base.SummaryClass { |
| 1612 /** |
| 1613 * Length of the documentation comment (prior to replacing '\r\n' with '\n'). |
| 1614 */ |
| 1615 @Id(0) |
| 1616 @deprecated |
| 1617 int get length; |
| 1618 |
| 1619 /** |
| 1620 * Offset of the beginning of the documentation comment relative to the |
| 1621 * beginning of the file. |
| 1622 */ |
| 1623 @Id(2) |
| 1624 @deprecated |
| 1625 int get offset; |
| 1626 |
| 1627 /** |
| 1628 * Text of the documentation comment, with '\r\n' replaced by '\n'. |
| 1629 * |
| 1630 * References appearing within the doc comment in square brackets are not |
| 1631 * specially encoded. |
| 1632 */ |
| 1633 @Id(1) |
| 1634 String get text; |
| 1635 } |
| 1636 |
| 1637 /** |
| 1638 * Unlinked summary information about an enum declaration. |
| 1639 */ |
| 1640 abstract class UnlinkedEnum extends base.SummaryClass { |
| 1641 /** |
| 1642 * Annotations for this enum. |
| 1643 */ |
| 1644 @Id(4) |
| 1645 List<UnlinkedConst> get annotations; |
| 1646 |
| 1647 /** |
| 1648 * Code range of the enum. |
| 1649 */ |
| 1650 @informative |
| 1651 @Id(5) |
| 1652 CodeRange get codeRange; |
| 1653 |
| 1654 /** |
| 1655 * Documentation comment for the enum, or `null` if there is no documentation |
| 1656 * comment. |
| 1657 */ |
| 1658 @informative |
| 1659 @Id(3) |
| 1660 UnlinkedDocumentationComment get documentationComment; |
| 1661 |
| 1662 /** |
| 1663 * Name of the enum type. |
| 1664 */ |
| 1665 @Id(0) |
| 1666 String get name; |
| 1667 |
| 1668 /** |
| 1669 * Offset of the enum name relative to the beginning of the file. |
| 1670 */ |
| 1671 @informative |
| 1672 @Id(1) |
| 1673 int get nameOffset; |
| 1674 |
| 1675 /** |
| 1676 * Values listed in the enum declaration, in declaration order. |
| 1677 */ |
| 1678 @Id(2) |
| 1679 List<UnlinkedEnumValue> get values; |
| 1680 } |
| 1681 |
| 1682 /** |
| 1683 * Unlinked summary information about a single enumerated value in an enum |
| 1684 * declaration. |
| 1685 */ |
| 1686 abstract class UnlinkedEnumValue extends base.SummaryClass { |
| 1687 /** |
| 1688 * Documentation comment for the enum value, or `null` if there is no |
| 1689 * documentation comment. |
| 1690 */ |
| 1691 @informative |
| 1692 @Id(2) |
| 1693 UnlinkedDocumentationComment get documentationComment; |
| 1694 |
| 1695 /** |
| 1696 * Name of the enumerated value. |
| 1697 */ |
| 1698 @Id(0) |
| 1699 String get name; |
| 1700 |
| 1701 /** |
| 1702 * Offset of the enum value name relative to the beginning of the file. |
| 1703 */ |
| 1704 @informative |
| 1705 @Id(1) |
| 1706 int get nameOffset; |
| 1707 } |
| 1708 |
| 1709 /** |
| 1710 * Unlinked summary information about a function, method, getter, or setter |
| 1711 * declaration. |
| 1712 */ |
| 1713 abstract class UnlinkedExecutable extends base.SummaryClass { |
| 1714 /** |
| 1715 * Annotations for this executable. |
| 1716 */ |
| 1717 @Id(6) |
| 1718 List<UnlinkedConst> get annotations; |
| 1719 |
| 1720 /** |
| 1721 * If this executable's function body is declared using `=>`, the expression |
| 1722 * to the right of the `=>`. May be omitted if neither type inference nor |
| 1723 * constant evaluation depends on the function body. |
| 1724 */ |
| 1725 @Id(29) |
| 1726 UnlinkedConst get bodyExpr; |
| 1727 |
| 1728 /** |
| 1729 * Code range of the executable. |
| 1730 */ |
| 1731 @informative |
| 1732 @Id(26) |
| 1733 CodeRange get codeRange; |
| 1734 |
| 1735 /** |
| 1736 * If a constant [UnlinkedExecutableKind.constructor], the constructor |
| 1737 * initializers. Otherwise empty. |
| 1738 */ |
| 1739 @Id(14) |
| 1740 List<UnlinkedConstructorInitializer> get constantInitializers; |
| 1741 |
| 1742 /** |
| 1743 * If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`, |
| 1744 * a nonzero slot id which is unique within this compilation unit. If this id |
| 1745 * is found in [LinkedUnit.constCycles], then this constructor is part of a |
| 1746 * cycle. |
| 1747 * |
| 1748 * Otherwise, zero. |
| 1749 */ |
| 1750 @Id(25) |
| 1751 int get constCycleSlot; |
| 1752 |
| 1753 /** |
| 1754 * Documentation comment for the executable, or `null` if there is no |
| 1755 * documentation comment. |
| 1756 */ |
| 1757 @informative |
| 1758 @Id(7) |
| 1759 UnlinkedDocumentationComment get documentationComment; |
| 1760 |
| 1761 /** |
| 1762 * If this executable's return type is inferable, nonzero slot id |
| 1763 * identifying which entry in [LinkedUnit.types] contains the inferred |
| 1764 * return type. If there is no matching entry in [LinkedUnit.types], then |
| 1765 * no return type was inferred for this variable, so its static type is |
| 1766 * `dynamic`. |
| 1767 */ |
| 1768 @Id(5) |
| 1769 int get inferredReturnTypeSlot; |
| 1770 |
| 1771 /** |
| 1772 * Indicates whether the executable is declared using the `abstract` keyword. |
| 1773 */ |
| 1774 @Id(10) |
| 1775 bool get isAbstract; |
| 1776 |
| 1777 /** |
| 1778 * Indicates whether the executable has body marked as being asynchronous. |
| 1779 */ |
| 1780 @informative |
| 1781 @Id(27) |
| 1782 bool get isAsynchronous; |
| 1783 |
| 1784 /** |
| 1785 * Indicates whether the executable is declared using the `const` keyword. |
| 1786 */ |
| 1787 @Id(12) |
| 1788 bool get isConst; |
| 1789 |
| 1790 /** |
| 1791 * Indicates whether the executable is declared using the `external` keyword. |
| 1792 */ |
| 1793 @Id(11) |
| 1794 bool get isExternal; |
| 1795 |
| 1796 /** |
| 1797 * Indicates whether the executable is declared using the `factory` keyword. |
| 1798 */ |
| 1799 @Id(8) |
| 1800 bool get isFactory; |
| 1801 |
| 1802 /** |
| 1803 * Indicates whether the executable has body marked as being a generator. |
| 1804 */ |
| 1805 @informative |
| 1806 @Id(28) |
| 1807 bool get isGenerator; |
| 1808 |
| 1809 /** |
| 1810 * Indicates whether the executable is a redirected constructor. |
| 1811 */ |
| 1812 @Id(13) |
| 1813 bool get isRedirectedConstructor; |
| 1814 |
| 1815 /** |
| 1816 * Indicates whether the executable is declared using the `static` keyword. |
| 1817 * |
| 1818 * Note that for top level executables, this flag is false, since they are |
| 1819 * not declared using the `static` keyword (even though they are considered |
| 1820 * static for semantic purposes). |
| 1821 */ |
| 1822 @Id(9) |
| 1823 bool get isStatic; |
| 1824 |
| 1825 /** |
| 1826 * The kind of the executable (function/method, getter, setter, or |
| 1827 * constructor). |
| 1828 */ |
| 1829 @Id(4) |
| 1830 UnlinkedExecutableKind get kind; |
| 1831 |
| 1832 /** |
| 1833 * The list of local functions. |
| 1834 */ |
| 1835 @Id(18) |
| 1836 List<UnlinkedExecutable> get localFunctions; |
| 1837 |
| 1838 /** |
| 1839 * The list of local labels. |
| 1840 */ |
| 1841 @informative |
| 1842 @Id(22) |
| 1843 List<UnlinkedLabel> get localLabels; |
| 1844 |
| 1845 /** |
| 1846 * The list of local variables. |
| 1847 */ |
| 1848 @informative |
| 1849 @Id(19) |
| 1850 List<UnlinkedVariable> get localVariables; |
| 1851 |
| 1852 /** |
| 1853 * Name of the executable. For setters, this includes the trailing "=". For |
| 1854 * named constructors, this excludes the class name and excludes the ".". |
| 1855 * For unnamed constructors, this is the empty string. |
| 1856 */ |
| 1857 @Id(1) |
| 1858 String get name; |
| 1859 |
| 1860 /** |
| 1861 * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
| 1862 * the offset of the end of the constructor name. Otherwise zero. |
| 1863 */ |
| 1864 @informative |
| 1865 @Id(23) |
| 1866 int get nameEnd; |
| 1867 |
| 1868 /** |
| 1869 * Offset of the executable name relative to the beginning of the file. For |
| 1870 * named constructors, this excludes the class name and excludes the ".". |
| 1871 * For unnamed constructors, this is the offset of the class name (i.e. the |
| 1872 * offset of the second "C" in "class C { C(); }"). |
| 1873 */ |
| 1874 @informative |
| 1875 @Id(0) |
| 1876 int get nameOffset; |
| 1877 |
| 1878 /** |
| 1879 * Parameters of the executable, if any. Note that getters have no |
| 1880 * parameters (hence this will be the empty list), and setters have a single |
| 1881 * parameter. |
| 1882 */ |
| 1883 @Id(2) |
| 1884 List<UnlinkedParam> get parameters; |
| 1885 |
| 1886 /** |
| 1887 * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
| 1888 * the offset of the period before the constructor name. Otherwise zero. |
| 1889 */ |
| 1890 @informative |
| 1891 @Id(24) |
| 1892 int get periodOffset; |
| 1893 |
| 1894 /** |
| 1895 * If [isRedirectedConstructor] and [isFactory] are both `true`, the |
| 1896 * constructor to which this constructor redirects; otherwise empty. |
| 1897 */ |
| 1898 @Id(15) |
| 1899 EntityRef get redirectedConstructor; |
| 1900 |
| 1901 /** |
| 1902 * If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the |
| 1903 * name of the constructor that this constructor redirects to; otherwise |
| 1904 * empty. |
| 1905 */ |
| 1906 @Id(17) |
| 1907 String get redirectedConstructorName; |
| 1908 |
| 1909 /** |
| 1910 * Declared return type of the executable. Absent if the executable is a |
| 1911 * constructor or the return type is implicit. Absent for executables |
| 1912 * associated with variable initializers and closures, since these |
| 1913 * executables may have return types that are not accessible via direct |
| 1914 * imports. |
| 1915 */ |
| 1916 @Id(3) |
| 1917 EntityRef get returnType; |
| 1918 |
| 1919 /** |
| 1920 * Type parameters of the executable, if any. Empty if support for generic |
| 1921 * method syntax is disabled. |
| 1922 */ |
| 1923 @Id(16) |
| 1924 List<UnlinkedTypeParam> get typeParameters; |
| 1925 |
| 1926 /** |
| 1927 * If a local function, the length of the visible range; zero otherwise. |
| 1928 */ |
| 1929 @Id(20) |
| 1930 int get visibleLength; |
| 1931 |
| 1932 /** |
| 1933 * If a local function, the beginning of the visible range; zero otherwise. |
| 1934 */ |
| 1935 @Id(21) |
| 1936 int get visibleOffset; |
| 1937 } |
| 1938 |
| 1939 /** |
| 1940 * Enum used to indicate the kind of an executable. |
| 1941 */ |
| 1942 enum UnlinkedExecutableKind { |
| 1943 /** |
| 1944 * Executable is a function or method. |
| 1945 */ |
| 1946 functionOrMethod, |
| 1947 |
| 1948 /** |
| 1949 * Executable is a getter. |
| 1950 */ |
| 1951 getter, |
| 1952 |
| 1953 /** |
| 1954 * Executable is a setter. |
| 1955 */ |
| 1956 setter, |
| 1957 |
| 1958 /** |
| 1959 * Executable is a constructor. |
| 1960 */ |
| 1961 constructor |
| 1962 } |
| 1963 |
| 1964 /** |
| 1965 * Unlinked summary information about an export declaration (stored outside |
| 1966 * [UnlinkedPublicNamespace]). |
| 1967 */ |
| 1968 abstract class UnlinkedExportNonPublic extends base.SummaryClass { |
| 1969 /** |
| 1970 * Annotations for this export directive. |
| 1971 */ |
| 1972 @Id(3) |
| 1973 List<UnlinkedConst> get annotations; |
| 1974 |
| 1975 /** |
| 1976 * Offset of the "export" keyword. |
| 1977 */ |
| 1978 @informative |
| 1979 @Id(0) |
| 1980 int get offset; |
| 1981 |
| 1982 /** |
| 1983 * End of the URI string (including quotes) relative to the beginning of the |
| 1984 * file. |
| 1985 */ |
| 1986 @informative |
| 1987 @Id(1) |
| 1988 int get uriEnd; |
| 1989 |
| 1990 /** |
| 1991 * Offset of the URI string (including quotes) relative to the beginning of |
| 1992 * the file. |
| 1993 */ |
| 1994 @informative |
| 1995 @Id(2) |
| 1996 int get uriOffset; |
| 1997 } |
| 1998 |
| 1999 /** |
| 2000 * Unlinked summary information about an export declaration (stored inside |
| 2001 * [UnlinkedPublicNamespace]). |
| 2002 */ |
| 2003 abstract class UnlinkedExportPublic extends base.SummaryClass { |
| 2004 /** |
| 2005 * Combinators contained in this export declaration. |
| 2006 */ |
| 2007 @Id(1) |
| 2008 List<UnlinkedCombinator> get combinators; |
| 2009 |
| 2010 /** |
| 2011 * Configurations used to control which library will actually be loaded at |
| 2012 * run-time. |
| 2013 */ |
| 2014 @Id(2) |
| 2015 List<UnlinkedConfiguration> get configurations; |
| 2016 |
| 2017 /** |
| 2018 * URI used in the source code to reference the exported library. |
| 2019 */ |
| 2020 @Id(0) |
| 2021 String get uri; |
| 2022 } |
| 2023 |
| 2024 /** |
| 2025 * Enum representing the various kinds of assignment operations combined |
| 2026 * with: |
| 2027 * [UnlinkedConstOperation.assignToRef], |
| 2028 * [UnlinkedConstOperation.assignToProperty], |
| 2029 * [UnlinkedConstOperation.assignToIndex]. |
| 2030 */ |
| 2031 enum UnlinkedExprAssignOperator { |
| 2032 /** |
| 2033 * Perform simple assignment `target = operand`. |
| 2034 */ |
| 2035 assign, |
| 2036 |
| 2037 /** |
| 2038 * Perform `target ??= operand`. |
| 2039 */ |
| 2040 ifNull, |
| 2041 |
| 2042 /** |
| 2043 * Perform `target *= operand`. |
| 2044 */ |
| 2045 multiply, |
| 2046 |
| 2047 /** |
| 2048 * Perform `target /= operand`. |
| 2049 */ |
| 2050 divide, |
| 2051 |
| 2052 /** |
| 2053 * Perform `target ~/= operand`. |
| 2054 */ |
| 2055 floorDivide, |
| 2056 |
| 2057 /** |
| 2058 * Perform `target %= operand`. |
| 2059 */ |
| 2060 modulo, |
| 2061 |
| 2062 /** |
| 2063 * Perform `target += operand`. |
| 2064 */ |
| 2065 plus, |
| 2066 |
| 2067 /** |
| 2068 * Perform `target -= operand`. |
| 2069 */ |
| 2070 minus, |
| 2071 |
| 2072 /** |
| 2073 * Perform `target <<= operand`. |
| 2074 */ |
| 2075 shiftLeft, |
| 2076 |
| 2077 /** |
| 2078 * Perform `target >>= operand`. |
| 2079 */ |
| 2080 shiftRight, |
| 2081 |
| 2082 /** |
| 2083 * Perform `target &= operand`. |
| 2084 */ |
| 2085 bitAnd, |
| 2086 |
| 2087 /** |
| 2088 * Perform `target ^= operand`. |
| 2089 */ |
| 2090 bitXor, |
| 2091 |
| 2092 /** |
| 2093 * Perform `target |= operand`. |
| 2094 */ |
| 2095 bitOr, |
| 2096 |
| 2097 /** |
| 2098 * Perform `++target`. |
| 2099 */ |
| 2100 prefixIncrement, |
| 2101 |
| 2102 /** |
| 2103 * Perform `--target`. |
| 2104 */ |
| 2105 prefixDecrement, |
| 2106 |
| 2107 /** |
| 2108 * Perform `target++`. |
| 2109 */ |
| 2110 postfixIncrement, |
| 2111 |
| 2112 /** |
| 2113 * Perform `target++`. |
| 2114 */ |
| 2115 postfixDecrement, |
| 2116 } |
| 2117 |
| 2118 /** |
| 2119 * Unlinked summary information about an import declaration. |
| 2120 */ |
| 2121 abstract class UnlinkedImport extends base.SummaryClass { |
| 2122 /** |
| 2123 * Annotations for this import declaration. |
| 2124 */ |
| 2125 @Id(8) |
| 2126 List<UnlinkedConst> get annotations; |
| 2127 |
| 2128 /** |
| 2129 * Combinators contained in this import declaration. |
| 2130 */ |
| 2131 @Id(4) |
| 2132 List<UnlinkedCombinator> get combinators; |
| 2133 |
| 2134 /** |
| 2135 * Configurations used to control which library will actually be loaded at |
| 2136 * run-time. |
| 2137 */ |
| 2138 @Id(10) |
| 2139 List<UnlinkedConfiguration> get configurations; |
| 2140 |
| 2141 /** |
| 2142 * Indicates whether the import declaration uses the `deferred` keyword. |
| 2143 */ |
| 2144 @Id(9) |
| 2145 bool get isDeferred; |
| 2146 |
| 2147 /** |
| 2148 * Indicates whether the import declaration is implicit. |
| 2149 */ |
| 2150 @Id(5) |
| 2151 bool get isImplicit; |
| 2152 |
| 2153 /** |
| 2154 * If [isImplicit] is false, offset of the "import" keyword. If [isImplicit] |
| 2155 * is true, zero. |
| 2156 */ |
| 2157 @informative |
| 2158 @Id(0) |
| 2159 int get offset; |
| 2160 |
| 2161 /** |
| 2162 * Offset of the prefix name relative to the beginning of the file, or zero |
| 2163 * if there is no prefix. |
| 2164 */ |
| 2165 @informative |
| 2166 @Id(6) |
| 2167 int get prefixOffset; |
| 2168 |
| 2169 /** |
| 2170 * Index into [UnlinkedUnit.references] of the prefix declared by this |
| 2171 * import declaration, or zero if this import declaration declares no prefix. |
| 2172 * |
| 2173 * Note that multiple imports can declare the same prefix. |
| 2174 */ |
| 2175 @Id(7) |
| 2176 int get prefixReference; |
| 2177 |
| 2178 /** |
| 2179 * URI used in the source code to reference the imported library. |
| 2180 */ |
| 2181 @Id(1) |
| 2182 String get uri; |
| 2183 |
| 2184 /** |
| 2185 * End of the URI string (including quotes) relative to the beginning of the |
| 2186 * file. If [isImplicit] is true, zero. |
| 2187 */ |
| 2188 @informative |
| 2189 @Id(2) |
| 2190 int get uriEnd; |
| 2191 |
| 2192 /** |
| 2193 * Offset of the URI string (including quotes) relative to the beginning of |
| 2194 * the file. If [isImplicit] is true, zero. |
| 2195 */ |
| 2196 @informative |
| 2197 @Id(3) |
| 2198 int get uriOffset; |
| 2199 } |
| 2200 |
| 2201 /** |
| 2202 * Unlinked summary information about a label. |
| 2203 */ |
| 2204 abstract class UnlinkedLabel extends base.SummaryClass { |
| 2205 /** |
| 2206 * Return `true` if this label is associated with a `switch` member (`case` or |
| 2207 * `default`). |
| 2208 */ |
| 2209 @Id(2) |
| 2210 bool get isOnSwitchMember; |
| 2211 |
| 2212 /** |
| 2213 * Return `true` if this label is associated with a `switch` statement. |
| 2214 */ |
| 2215 @Id(3) |
| 2216 bool get isOnSwitchStatement; |
| 2217 |
| 2218 /** |
| 2219 * Name of the label. |
| 2220 */ |
| 2221 @Id(0) |
| 2222 String get name; |
| 2223 |
| 2224 /** |
| 2225 * Offset of the label relative to the beginning of the file. |
| 2226 */ |
| 2227 @informative |
| 2228 @Id(1) |
| 2229 int get nameOffset; |
| 2230 } |
| 2231 |
| 2232 /** |
| 2233 * Unlinked summary information about a function parameter. |
| 2234 */ |
| 2235 abstract class UnlinkedParam extends base.SummaryClass { |
| 2236 /** |
| 2237 * Annotations for this parameter. |
| 2238 */ |
| 2239 @Id(9) |
| 2240 List<UnlinkedConst> get annotations; |
| 2241 |
| 2242 /** |
| 2243 * Code range of the parameter. |
| 2244 */ |
| 2245 @informative |
| 2246 @Id(7) |
| 2247 CodeRange get codeRange; |
| 2248 |
| 2249 /** |
| 2250 * If the parameter has a default value, the source text of the constant |
| 2251 * expression in the default value. Otherwise the empty string. |
| 2252 */ |
| 2253 @informative |
| 2254 @Id(13) |
| 2255 String get defaultValueCode; |
| 2256 |
| 2257 /** |
| 2258 * If this parameter's type is inferable, nonzero slot id identifying which |
| 2259 * entry in [LinkedLibrary.types] contains the inferred type. If there is no |
| 2260 * matching entry in [LinkedLibrary.types], then no type was inferred for |
| 2261 * this variable, so its static type is `dynamic`. |
| 2262 * |
| 2263 * Note that although strong mode considers initializing formals to be |
| 2264 * inferable, they are not marked as such in the summary; if their type is |
| 2265 * not specified, they always inherit the static type of the corresponding |
| 2266 * field. |
| 2267 */ |
| 2268 @Id(2) |
| 2269 int get inferredTypeSlot; |
| 2270 |
| 2271 /** |
| 2272 * If this is a parameter of an instance method, a nonzero slot id which is |
| 2273 * unique within this compilation unit. If this id is found in |
| 2274 * [LinkedUnit.parametersInheritingCovariant], then this parameter inherits |
| 2275 * `@covariant` behavior from a base class. |
| 2276 * |
| 2277 * Otherwise, zero. |
| 2278 */ |
| 2279 @Id(14) |
| 2280 int get inheritsCovariantSlot; |
| 2281 |
| 2282 /** |
| 2283 * The synthetic initializer function of the parameter. Absent if the variabl
e |
| 2284 * does not have an initializer. |
| 2285 */ |
| 2286 @Id(12) |
| 2287 UnlinkedExecutable get initializer; |
| 2288 |
| 2289 /** |
| 2290 * Indicates whether this is a function-typed parameter. |
| 2291 */ |
| 2292 @Id(5) |
| 2293 bool get isFunctionTyped; |
| 2294 |
| 2295 /** |
| 2296 * Indicates whether this is an initializing formal parameter (i.e. it is |
| 2297 * declared using `this.` syntax). |
| 2298 */ |
| 2299 @Id(6) |
| 2300 bool get isInitializingFormal; |
| 2301 |
| 2302 /** |
| 2303 * Kind of the parameter. |
| 2304 */ |
| 2305 @Id(4) |
| 2306 UnlinkedParamKind get kind; |
| 2307 |
| 2308 /** |
| 2309 * Name of the parameter. |
| 2310 */ |
| 2311 @Id(0) |
| 2312 String get name; |
| 2313 |
| 2314 /** |
| 2315 * Offset of the parameter name relative to the beginning of the file. |
| 2316 */ |
| 2317 @informative |
| 2318 @Id(1) |
| 2319 int get nameOffset; |
| 2320 |
| 2321 /** |
| 2322 * If [isFunctionTyped] is `true`, the parameters of the function type. |
| 2323 */ |
| 2324 @Id(8) |
| 2325 List<UnlinkedParam> get parameters; |
| 2326 |
| 2327 /** |
| 2328 * If [isFunctionTyped] is `true`, the declared return type. If |
| 2329 * [isFunctionTyped] is `false`, the declared type. Absent if the type is |
| 2330 * implicit. |
| 2331 */ |
| 2332 @Id(3) |
| 2333 EntityRef get type; |
| 2334 |
| 2335 /** |
| 2336 * The length of the visible range. |
| 2337 */ |
| 2338 @Id(10) |
| 2339 int get visibleLength; |
| 2340 |
| 2341 /** |
| 2342 * The beginning of the visible range. |
| 2343 */ |
| 2344 @Id(11) |
| 2345 int get visibleOffset; |
| 2346 } |
| 2347 |
| 2348 /** |
| 2349 * Enum used to indicate the kind of a parameter. |
| 2350 */ |
| 2351 enum UnlinkedParamKind { |
| 2352 /** |
| 2353 * Parameter is required. |
| 2354 */ |
| 2355 required, |
| 2356 |
| 2357 /** |
| 2358 * Parameter is positional optional (enclosed in `[]`) |
| 2359 */ |
| 2360 positional, |
| 2361 |
| 2362 /** |
| 2363 * Parameter is named optional (enclosed in `{}`) |
| 2364 */ |
| 2365 named |
| 2366 } |
| 2367 |
| 2368 /** |
| 2369 * Unlinked summary information about a part declaration. |
| 2370 */ |
| 2371 abstract class UnlinkedPart extends base.SummaryClass { |
| 2372 /** |
| 2373 * Annotations for this part declaration. |
| 2374 */ |
| 2375 @Id(2) |
| 2376 List<UnlinkedConst> get annotations; |
| 2377 |
| 2378 /** |
| 2379 * End of the URI string (including quotes) relative to the beginning of the |
| 2380 * file. |
| 2381 */ |
| 2382 @informative |
| 2383 @Id(0) |
| 2384 int get uriEnd; |
| 2385 |
| 2386 /** |
| 2387 * Offset of the URI string (including quotes) relative to the beginning of |
| 2388 * the file. |
| 2389 */ |
| 2390 @informative |
| 2391 @Id(1) |
| 2392 int get uriOffset; |
| 2393 } |
| 2394 |
| 2395 /** |
| 2396 * Unlinked summary information about a specific name contributed by a |
| 2397 * compilation unit to a library's public namespace. |
| 2398 * |
| 2399 * TODO(paulberry): some of this information is redundant with information |
| 2400 * elsewhere in the summary. Consider reducing the redundancy to reduce |
| 2401 * summary size. |
| 2402 */ |
| 2403 abstract class UnlinkedPublicName extends base.SummaryClass { |
| 2404 /** |
| 2405 * The kind of object referred to by the name. |
| 2406 */ |
| 2407 @Id(1) |
| 2408 ReferenceKind get kind; |
| 2409 |
| 2410 /** |
| 2411 * If this [UnlinkedPublicName] is a class, the list of members which can be |
| 2412 * referenced statically - static fields, static methods, and constructors. |
| 2413 * Otherwise empty. |
| 2414 * |
| 2415 * Unnamed constructors are not included since they do not constitute a |
| 2416 * separate name added to any namespace. |
| 2417 */ |
| 2418 @Id(2) |
| 2419 List<UnlinkedPublicName> get members; |
| 2420 |
| 2421 /** |
| 2422 * The name itself. |
| 2423 */ |
| 2424 @Id(0) |
| 2425 String get name; |
| 2426 |
| 2427 /** |
| 2428 * If the entity being referred to is generic, the number of type parameters |
| 2429 * it accepts. Otherwise zero. |
| 2430 */ |
| 2431 @Id(3) |
| 2432 int get numTypeParameters; |
| 2433 } |
| 2434 |
| 2435 /** |
| 2436 * Unlinked summary information about what a compilation unit contributes to a |
| 2437 * library's public namespace. This is the subset of [UnlinkedUnit] that is |
| 2438 * required from dependent libraries in order to perform prelinking. |
| 2439 */ |
| 2440 @TopLevel('UPNS') |
| 2441 abstract class UnlinkedPublicNamespace extends base.SummaryClass { |
| 2442 factory UnlinkedPublicNamespace.fromBuffer(List<int> buffer) => |
| 2443 generated.readUnlinkedPublicNamespace(buffer); |
| 2444 |
| 2445 /** |
| 2446 * Export declarations in the compilation unit. |
| 2447 */ |
| 2448 @Id(2) |
| 2449 List<UnlinkedExportPublic> get exports; |
| 2450 |
| 2451 /** |
| 2452 * Public names defined in the compilation unit. |
| 2453 * |
| 2454 * TODO(paulberry): consider sorting these names to reduce unnecessary |
| 2455 * relinking. |
| 2456 */ |
| 2457 @Id(0) |
| 2458 List<UnlinkedPublicName> get names; |
| 2459 |
| 2460 /** |
| 2461 * URIs referenced by part declarations in the compilation unit. |
| 2462 */ |
| 2463 @Id(1) |
| 2464 List<String> get parts; |
| 2465 } |
| 2466 |
| 2467 /** |
| 2468 * Unlinked summary information about a name referred to in one library that |
| 2469 * might be defined in another. |
| 2470 */ |
| 2471 abstract class UnlinkedReference extends base.SummaryClass { |
| 2472 /** |
| 2473 * Name of the entity being referred to. For the pseudo-type `dynamic`, the |
| 2474 * string is "dynamic". For the pseudo-type `void`, the string is "void". |
| 2475 * For the pseudo-type `bottom`, the string is "*bottom*". |
| 2476 */ |
| 2477 @Id(0) |
| 2478 String get name; |
| 2479 |
| 2480 /** |
| 2481 * Prefix used to refer to the entity, or zero if no prefix is used. This is |
| 2482 * an index into [UnlinkedUnit.references]. |
| 2483 * |
| 2484 * Prefix references must always point backward; that is, for all i, if |
| 2485 * UnlinkedUnit.references[i].prefixReference != 0, then |
| 2486 * UnlinkedUnit.references[i].prefixReference < i. |
| 2487 */ |
| 2488 @Id(1) |
| 2489 int get prefixReference; |
| 2490 } |
| 2491 |
| 2492 /** |
| 2493 * Unlinked summary information about a typedef declaration. |
| 2494 */ |
| 2495 abstract class UnlinkedTypedef extends base.SummaryClass { |
| 2496 /** |
| 2497 * Annotations for this typedef. |
| 2498 */ |
| 2499 @Id(4) |
| 2500 List<UnlinkedConst> get annotations; |
| 2501 |
| 2502 /** |
| 2503 * Code range of the typedef. |
| 2504 */ |
| 2505 @informative |
| 2506 @Id(7) |
| 2507 CodeRange get codeRange; |
| 2508 |
| 2509 /** |
| 2510 * Documentation comment for the typedef, or `null` if there is no |
| 2511 * documentation comment. |
| 2512 */ |
| 2513 @informative |
| 2514 @Id(6) |
| 2515 UnlinkedDocumentationComment get documentationComment; |
| 2516 |
| 2517 /** |
| 2518 * Name of the typedef. |
| 2519 */ |
| 2520 @Id(0) |
| 2521 String get name; |
| 2522 |
| 2523 /** |
| 2524 * Offset of the typedef name relative to the beginning of the file. |
| 2525 */ |
| 2526 @informative |
| 2527 @Id(1) |
| 2528 int get nameOffset; |
| 2529 |
| 2530 /** |
| 2531 * Parameters of the executable, if any. |
| 2532 */ |
| 2533 @Id(3) |
| 2534 List<UnlinkedParam> get parameters; |
| 2535 |
| 2536 /** |
| 2537 * Return type of the typedef. |
| 2538 */ |
| 2539 @Id(2) |
| 2540 EntityRef get returnType; |
| 2541 |
| 2542 /** |
| 2543 * Type parameters of the typedef, if any. |
| 2544 */ |
| 2545 @Id(5) |
| 2546 List<UnlinkedTypeParam> get typeParameters; |
| 2547 } |
| 2548 |
| 2549 /** |
| 2550 * Unlinked summary information about a type parameter declaration. |
| 2551 */ |
| 2552 abstract class UnlinkedTypeParam extends base.SummaryClass { |
| 2553 /** |
| 2554 * Annotations for this type parameter. |
| 2555 */ |
| 2556 @Id(3) |
| 2557 List<UnlinkedConst> get annotations; |
| 2558 |
| 2559 /** |
| 2560 * Bound of the type parameter, if a bound is explicitly declared. Otherwise |
| 2561 * null. |
| 2562 */ |
| 2563 @Id(2) |
| 2564 EntityRef get bound; |
| 2565 |
| 2566 /** |
| 2567 * Code range of the type parameter. |
| 2568 */ |
| 2569 @informative |
| 2570 @Id(4) |
| 2571 CodeRange get codeRange; |
| 2572 |
| 2573 /** |
| 2574 * Name of the type parameter. |
| 2575 */ |
| 2576 @Id(0) |
| 2577 String get name; |
| 2578 |
| 2579 /** |
| 2580 * Offset of the type parameter name relative to the beginning of the file. |
| 2581 */ |
| 2582 @informative |
| 2583 @Id(1) |
| 2584 int get nameOffset; |
| 2585 } |
| 2586 |
| 2587 /** |
| 2588 * Unlinked summary information about a compilation unit ("part file"). |
| 2589 */ |
| 2590 @TopLevel('UUnt') |
| 2591 abstract class UnlinkedUnit extends base.SummaryClass { |
| 2592 factory UnlinkedUnit.fromBuffer(List<int> buffer) => |
| 2593 generated.readUnlinkedUnit(buffer); |
| 2594 |
| 2595 /** |
| 2596 * Classes declared in the compilation unit. |
| 2597 */ |
| 2598 @Id(2) |
| 2599 List<UnlinkedClass> get classes; |
| 2600 |
| 2601 /** |
| 2602 * Code range of the unit. |
| 2603 */ |
| 2604 @informative |
| 2605 @Id(15) |
| 2606 CodeRange get codeRange; |
| 2607 |
| 2608 /** |
| 2609 * Enums declared in the compilation unit. |
| 2610 */ |
| 2611 @Id(12) |
| 2612 List<UnlinkedEnum> get enums; |
| 2613 |
| 2614 /** |
| 2615 * Top level executable objects (functions, getters, and setters) declared in |
| 2616 * the compilation unit. |
| 2617 */ |
| 2618 @Id(4) |
| 2619 List<UnlinkedExecutable> get executables; |
| 2620 |
| 2621 /** |
| 2622 * Export declarations in the compilation unit. |
| 2623 */ |
| 2624 @Id(13) |
| 2625 List<UnlinkedExportNonPublic> get exports; |
| 2626 |
| 2627 /** |
| 2628 * If this compilation unit was summarized in fallback mode, the path where |
| 2629 * the compilation unit may be found on disk. Otherwise empty. |
| 2630 * |
| 2631 * When this field is non-empty, all other fields in the data structure have |
| 2632 * their default values. |
| 2633 */ |
| 2634 @Id(16) |
| 2635 String get fallbackModePath; |
| 2636 |
| 2637 /** |
| 2638 * Import declarations in the compilation unit. |
| 2639 */ |
| 2640 @Id(5) |
| 2641 List<UnlinkedImport> get imports; |
| 2642 |
| 2643 /** |
| 2644 * Annotations for the library declaration, or the empty list if there is no |
| 2645 * library declaration. |
| 2646 */ |
| 2647 @Id(14) |
| 2648 List<UnlinkedConst> get libraryAnnotations; |
| 2649 |
| 2650 /** |
| 2651 * Documentation comment for the library, or `null` if there is no |
| 2652 * documentation comment. |
| 2653 */ |
| 2654 @informative |
| 2655 @Id(9) |
| 2656 UnlinkedDocumentationComment get libraryDocumentationComment; |
| 2657 |
| 2658 /** |
| 2659 * Name of the library (from a "library" declaration, if present). |
| 2660 */ |
| 2661 @Id(6) |
| 2662 String get libraryName; |
| 2663 |
| 2664 /** |
| 2665 * Length of the library name as it appears in the source code (or 0 if the |
| 2666 * library has no name). |
| 2667 */ |
| 2668 @informative |
| 2669 @Id(7) |
| 2670 int get libraryNameLength; |
| 2671 |
| 2672 /** |
| 2673 * Offset of the library name relative to the beginning of the file (or 0 if |
| 2674 * the library has no name). |
| 2675 */ |
| 2676 @informative |
| 2677 @Id(8) |
| 2678 int get libraryNameOffset; |
| 2679 |
| 2680 /** |
| 2681 * Offsets of the first character of each line in the source code. |
| 2682 */ |
| 2683 @informative |
| 2684 @Id(17) |
| 2685 List<int> get lineStarts; |
| 2686 |
| 2687 /** |
| 2688 * Part declarations in the compilation unit. |
| 2689 */ |
| 2690 @Id(11) |
| 2691 List<UnlinkedPart> get parts; |
| 2692 |
| 2693 /** |
| 2694 * Unlinked public namespace of this compilation unit. |
| 2695 */ |
| 2696 @Id(0) |
| 2697 UnlinkedPublicNamespace get publicNamespace; |
| 2698 |
| 2699 /** |
| 2700 * Top level and prefixed names referred to by this compilation unit. The |
| 2701 * zeroth element of this array is always populated and is used to represent |
| 2702 * the absence of a reference in places where a reference is optional (for |
| 2703 * example [UnlinkedReference.prefixReference or |
| 2704 * UnlinkedImport.prefixReference]). |
| 2705 */ |
| 2706 @Id(1) |
| 2707 List<UnlinkedReference> get references; |
| 2708 |
| 2709 /** |
| 2710 * Typedefs declared in the compilation unit. |
| 2711 */ |
| 2712 @Id(10) |
| 2713 List<UnlinkedTypedef> get typedefs; |
| 2714 |
| 2715 /** |
| 2716 * Top level variables declared in the compilation unit. |
| 2717 */ |
| 2718 @Id(3) |
| 2719 List<UnlinkedVariable> get variables; |
| 2720 } |
| 2721 |
| 2722 /** |
| 2723 * Unlinked summary information about a top level variable, local variable, or |
| 2724 * a field. |
| 2725 */ |
| 2726 abstract class UnlinkedVariable extends base.SummaryClass { |
| 2727 /** |
| 2728 * Annotations for this variable. |
| 2729 */ |
| 2730 @Id(8) |
| 2731 List<UnlinkedConst> get annotations; |
| 2732 |
| 2733 /** |
| 2734 * Code range of the variable. |
| 2735 */ |
| 2736 @informative |
| 2737 @Id(5) |
| 2738 CodeRange get codeRange; |
| 2739 |
| 2740 /** |
| 2741 * Documentation comment for the variable, or `null` if there is no |
| 2742 * documentation comment. |
| 2743 */ |
| 2744 @informative |
| 2745 @Id(10) |
| 2746 UnlinkedDocumentationComment get documentationComment; |
| 2747 |
| 2748 /** |
| 2749 * If this variable is inferable, nonzero slot id identifying which entry in |
| 2750 * [LinkedLibrary.types] contains the inferred type for this variable. If |
| 2751 * there is no matching entry in [LinkedLibrary.types], then no type was |
| 2752 * inferred for this variable, so its static type is `dynamic`. |
| 2753 */ |
| 2754 @Id(9) |
| 2755 int get inferredTypeSlot; |
| 2756 |
| 2757 /** |
| 2758 * The synthetic initializer function of the variable. Absent if the variable |
| 2759 * does not have an initializer. |
| 2760 */ |
| 2761 @Id(13) |
| 2762 UnlinkedExecutable get initializer; |
| 2763 |
| 2764 /** |
| 2765 * Indicates whether the variable is declared using the `const` keyword. |
| 2766 */ |
| 2767 @Id(6) |
| 2768 bool get isConst; |
| 2769 |
| 2770 /** |
| 2771 * Indicates whether the variable is declared using the `final` keyword. |
| 2772 */ |
| 2773 @Id(7) |
| 2774 bool get isFinal; |
| 2775 |
| 2776 /** |
| 2777 * Indicates whether the variable is declared using the `static` keyword. |
| 2778 * |
| 2779 * Note that for top level variables, this flag is false, since they are not |
| 2780 * declared using the `static` keyword (even though they are considered |
| 2781 * static for semantic purposes). |
| 2782 */ |
| 2783 @Id(4) |
| 2784 bool get isStatic; |
| 2785 |
| 2786 /** |
| 2787 * Name of the variable. |
| 2788 */ |
| 2789 @Id(0) |
| 2790 String get name; |
| 2791 |
| 2792 /** |
| 2793 * Offset of the variable name relative to the beginning of the file. |
| 2794 */ |
| 2795 @informative |
| 2796 @Id(1) |
| 2797 int get nameOffset; |
| 2798 |
| 2799 /** |
| 2800 * If this variable is propagable, nonzero slot id identifying which entry in |
| 2801 * [LinkedLibrary.types] contains the propagated type for this variable. If |
| 2802 * there is no matching entry in [LinkedLibrary.types], then this variable's |
| 2803 * propagated type is the same as its declared type. |
| 2804 * |
| 2805 * Non-propagable variables have a [propagatedTypeSlot] of zero. |
| 2806 */ |
| 2807 @Id(2) |
| 2808 int get propagatedTypeSlot; |
| 2809 |
| 2810 /** |
| 2811 * Declared type of the variable. Absent if the type is implicit. |
| 2812 */ |
| 2813 @Id(3) |
| 2814 EntityRef get type; |
| 2815 |
| 2816 /** |
| 2817 * If a local variable, the length of the visible range; zero otherwise. |
| 2818 */ |
| 2819 @Id(11) |
| 2820 int get visibleLength; |
| 2821 |
| 2822 /** |
| 2823 * If a local variable, the beginning of the visible range; zero otherwise. |
| 2824 */ |
| 2825 @Id(12) |
| 2826 int get visibleOffset; |
| 2827 } |
| OLD | NEW |