| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 * Annotation describing information which is not part of the public API to a | 50 * Annotation describing information which is not part of the public API to a |
| 51 * library; in other words, if this information (or any information it refers | 51 * library; in other words, if this information (or any information it refers |
| 52 * to) changes, libraries outside this one are unaffected. | 52 * to) changes, libraries outside this one are unaffected. |
| 53 * | 53 * |
| 54 * TODO(paulberry): currently the summary format does not contain private | 54 * TODO(paulberry): currently the summary format does not contain private |
| 55 * information. | 55 * information. |
| 56 */ | 56 */ |
| 57 const private = null; | 57 const private = null; |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Annotation describing a class which can be the top level object in an |
| 61 * encoded summary. |
| 62 */ |
| 63 const topLevel = null; |
| 64 |
| 65 /** |
| 60 * Information about a dependency that exists between one library and another | 66 * Information about a dependency that exists between one library and another |
| 61 * due to an "import" declaration. | 67 * due to an "import" declaration. |
| 62 */ | 68 */ |
| 63 class PrelinkedDependency { | 69 class PrelinkedDependency { |
| 64 /** | 70 /** |
| 65 * The relative URI used to import one library from the other. | 71 * The relative URI used to import one library from the other. |
| 66 */ | 72 */ |
| 67 String uri; | 73 String uri; |
| 68 } | 74 } |
| 69 | 75 |
| 70 /** | 76 /** |
| 71 * Pre-linked summary of a library. | 77 * Pre-linked summary of a library. |
| 72 */ | 78 */ |
| 79 @topLevel |
| 73 class PrelinkedLibrary { | 80 class PrelinkedLibrary { |
| 74 /** | 81 /** |
| 75 * The unlinked library summary. | 82 * The unlinked library summary. |
| 76 */ | 83 */ |
| 77 UnlinkedLibrary unlinked; | 84 UnlinkedLibrary unlinked; |
| 78 | 85 |
| 79 /** | 86 /** |
| 80 * The libraries that this library depends on (either via an explicit import | 87 * The libraries that this library depends on (either via an explicit import |
| 81 * statement or via the implicit dependencies on `dart:core` and | 88 * statement or via the implicit dependencies on `dart:core` and |
| 82 * `dart:async`). The first element of this array is a pseudo-dependency | 89 * `dart:async`). The first element of this array is a pseudo-dependency |
| (...skipping 24 matching lines...) Expand all Loading... |
| 107 * Information about the resolution of an [UnlinkedReference]. | 114 * Information about the resolution of an [UnlinkedReference]. |
| 108 */ | 115 */ |
| 109 class PrelinkedReference { | 116 class PrelinkedReference { |
| 110 /** | 117 /** |
| 111 * Index into [UnlinkedLibrary.dependencies] indicating which imported library | 118 * Index into [UnlinkedLibrary.dependencies] indicating which imported library |
| 112 * declares the entity being referred to. | 119 * declares the entity being referred to. |
| 113 */ | 120 */ |
| 114 int dependency; | 121 int dependency; |
| 115 | 122 |
| 116 /** | 123 /** |
| 117 * The kind of the entity being referred to. | 124 * The kind of the entity being referred to. For the pseudo-type `dynamic`, |
| 125 * the kind if [PrelinkedReferenceKind.classOrEnum]. |
| 118 */ | 126 */ |
| 119 PrelinkedReferenceKind kind; | 127 PrelinkedReferenceKind kind; |
| 120 } | 128 } |
| 121 | 129 |
| 122 /** | 130 /** |
| 123 * Enum used to indicate the kind of entity referred to by a | 131 * Enum used to indicate the kind of entity referred to by a |
| 124 * [PrelinkedReference]. | 132 * [PrelinkedReference]. |
| 125 */ | 133 */ |
| 126 enum PrelinkedReferenceKind { | 134 enum PrelinkedReferenceKind { |
| 127 /** | 135 /** |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 */ | 553 */ |
| 546 String name; | 554 String name; |
| 547 } | 555 } |
| 548 | 556 |
| 549 /** | 557 /** |
| 550 * Unlinked summary information about a name referred to in one library that | 558 * Unlinked summary information about a name referred to in one library that |
| 551 * might be defined in another. | 559 * might be defined in another. |
| 552 */ | 560 */ |
| 553 class UnlinkedReference { | 561 class UnlinkedReference { |
| 554 /** | 562 /** |
| 555 * Name of the entity being referred to. | 563 * Name of the entity being referred to. The empty string refers to the |
| 564 * pseudo-type `dynamic`. |
| 556 */ | 565 */ |
| 557 String name; | 566 String name; |
| 558 | 567 |
| 559 /** | 568 /** |
| 560 * Prefix used to refer to the entity. This is an index into | 569 * Prefix used to refer to the entity. This is an index into |
| 561 * [UnlinkedLibrary.prefixes]. | 570 * [UnlinkedLibrary.prefixes]. |
| 562 */ | 571 */ |
| 563 int prefix; | 572 int prefix; |
| 564 } | 573 } |
| 565 | 574 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 UnlinkedTypeRef bound; | 620 UnlinkedTypeRef bound; |
| 612 } | 621 } |
| 613 | 622 |
| 614 /** | 623 /** |
| 615 * Unlinked summary information about a reference to a type. | 624 * Unlinked summary information about a reference to a type. |
| 616 */ | 625 */ |
| 617 class UnlinkedTypeRef { | 626 class UnlinkedTypeRef { |
| 618 /** | 627 /** |
| 619 * Index into [UnlinkedLibrary.references] for the type being referred to, or | 628 * Index into [UnlinkedLibrary.references] for the type being referred to, or |
| 620 * zero if this is a reference to a type parameter. | 629 * zero if this is a reference to a type parameter. |
| 630 * |
| 631 * Note that since zero is also a valid index into |
| 632 * [UnlinkedLibrary.references], we cannot distinguish between references to |
| 633 * type parameters and references to types by checking [reference] against |
| 634 * zero. To distinguish between references to type parameters and references |
| 635 * to types, check whether [paramReference] is zero. |
| 621 */ | 636 */ |
| 622 int reference; | 637 int reference; |
| 623 | 638 |
| 624 /** | 639 /** |
| 625 * If this is a reference to a type parameter, one-based index into | 640 * If this is a reference to a type parameter, one-based index into the list |
| 626 * [UnlinkedClass.typeParameters] or [UnlinkedTypedef.typeParameters] for the | 641 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De |
| 627 * parameter being referenced. Otherwise zero. | 642 * Bruijn index conventions; that is, innermost parameters come first, and |
| 643 * if a class or method has multiple parameters, they are indexed from right |
| 644 * to left. So for instance, if the enclosing declaration is |
| 628 * | 645 * |
| 629 * If generic method syntax is enabled, this may also be a one-based index | 646 * class C<T,U> { |
| 630 * into [UnlinkedExecutable.typeParameters]. Note that this creates an | 647 * m<V,W> { |
| 631 * ambiguity since it allows executables with type parameters to be nested | 648 * ... |
| 632 * inside other declarations with type parameters (which might themselves be | 649 * } |
| 633 * executables). The ambiguity is resolved by considering this to be a | 650 * } |
| 634 * one-based index into a list that concatenates all type parameters that are | 651 * |
| 635 * in scope, listing the outermost type parameters first. | 652 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, |
| 653 * respectively. TODO(paulberry): test this. |
| 654 * |
| 655 * If the type being referred to is not a type parameter, [paramReference] is |
| 656 * zero. |
| 636 */ | 657 */ |
| 637 int paramReference; | 658 int paramReference; |
| 638 | 659 |
| 639 /** | 660 /** |
| 640 * If this is an instantiation of a generic type, the type arguments used to | 661 * If this is an instantiation of a generic type, the type arguments used to |
| 641 * instantiate it. Trailing type arguments of type `dynamic` are omitted. | 662 * instantiate it. Trailing type arguments of type `dynamic` are omitted. |
| 642 */ | 663 */ |
| 643 List<UnlinkedTypeRef> typeArguments; | 664 List<UnlinkedTypeRef> typeArguments; |
| 644 } | 665 } |
| 645 | 666 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 /** | 715 /** |
| 695 * Indicates whether the variable is declared using the `final` keyword. | 716 * Indicates whether the variable is declared using the `final` keyword. |
| 696 */ | 717 */ |
| 697 bool isFinal; | 718 bool isFinal; |
| 698 | 719 |
| 699 /** | 720 /** |
| 700 * Indicates whether the variable is declared using the `const` keyword. | 721 * Indicates whether the variable is declared using the `const` keyword. |
| 701 */ | 722 */ |
| 702 bool isConst; | 723 bool isConst; |
| 703 } | 724 } |
| OLD | NEW |