Index: pkg/analyzer/lib/src/summary/idl.dart |
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart |
index 07ce297d862f554e8745ed22650af665cee0e9bb..eeb604ac1abfe6b23af4f074579a03a05b47e560 100644 |
--- a/pkg/analyzer/lib/src/summary/idl.dart |
+++ b/pkg/analyzer/lib/src/summary/idl.dart |
@@ -971,7 +971,7 @@ abstract class UnlinkedClass extends base.SummaryClass { |
* Annotations for this class. |
*/ |
@Id(5) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Code range of the class. |
@@ -1119,1052 +1119,1051 @@ abstract class UnlinkedConfiguration extends base.SummaryClass { |
} |
/** |
- * Unlinked summary information about a compile-time constant expression, or a |
- * potentially constant expression. |
- * |
- * Constant expressions are represented using a simple stack-based language |
- * where [operations] is a sequence of operations to execute starting with an |
- * empty stack. Once all operations have been executed, the stack should |
- * contain a single value which is the value of the constant. Note that some |
- * operations consume additional data from the other fields of this class. |
+ * Unlinked summary information about a constructor initializer. |
*/ |
-abstract class UnlinkedConst extends base.SummaryClass { |
+abstract class UnlinkedConstructorInitializer extends base.SummaryClass { |
/** |
- * Sequence of operators used by assignment operations. |
+ * If there are `m` [arguments] and `n` [argumentNames], then each argument |
+ * from [arguments] with index `i` such that `n + i - m >= 0`, should be used |
+ * with the name at `n + i - m`. |
*/ |
- @Id(6) |
- List<UnlinkedExprAssignOperator> get assignmentOperators; |
+ @Id(4) |
+ List<String> get argumentNames; |
/** |
- * Sequence of 64-bit doubles consumed by the operation `pushDouble`. |
+ * If [kind] is `thisInvocation` or `superInvocation`, the arguments of the |
+ * invocation. Otherwise empty. |
*/ |
- @Id(4) |
- List<double> get doubles; |
+ @Id(3) |
+ List<UnlinkedExpr> get arguments; |
/** |
- * Sequence of unsigned 32-bit integers consumed by the operations |
- * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`, |
- * `makeList`, and `makeMap`. |
+ * If [kind] is `field`, the expression of the field initializer. |
+ * Otherwise `null`. |
*/ |
@Id(1) |
- List<int> get ints; |
+ UnlinkedExpr get expression; |
/** |
- * Indicates whether the expression is a valid potentially constant |
- * expression. |
+ * The kind of the constructor initializer (field, redirect, super). |
*/ |
- @Id(5) |
- bool get isValidConst; |
+ @Id(2) |
+ UnlinkedConstructorInitializerKind get kind; |
/** |
- * Sequence of operations to execute (starting with an empty stack) to form |
- * the constant value. |
+ * If [kind] is `field`, the name of the field declared in the class. If |
+ * [kind] is `thisInvocation`, the name of the constructor, declared in this |
+ * class, to redirect to. If [kind] is `superInvocation`, the name of the |
+ * constructor, declared in the superclass, to invoke. |
*/ |
@Id(0) |
- List<UnlinkedConstOperation> get operations; |
+ String get name; |
+} |
+/** |
+ * Enum used to indicate the kind of an constructor initializer. |
+ */ |
+enum UnlinkedConstructorInitializerKind { |
/** |
- * Sequence of language constructs consumed by the operations |
- * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note |
- * that in the case of `pushReference` (and sometimes `invokeConstructor` the |
- * actual entity being referred to may be something other than a type. |
+ * Initialization of a field. |
*/ |
- @Id(2) |
- List<EntityRef> get references; |
+ field, |
/** |
- * Sequence of strings consumed by the operations `pushString` and |
- * `invokeConstructor`. |
+ * Invocation of a constructor in the same class. |
*/ |
- @Id(3) |
- List<String> get strings; |
+ thisInvocation, |
+ |
+ /** |
+ * Invocation of a superclass' constructor. |
+ */ |
+ superInvocation |
} |
/** |
- * Enum representing the various kinds of operations which may be performed to |
- * produce a constant value. These options are assumed to execute in the |
- * context of a stack which is initially empty. |
+ * Unlinked summary information about a documentation comment. |
*/ |
-enum UnlinkedConstOperation { |
+abstract class UnlinkedDocumentationComment extends base.SummaryClass { |
/** |
- * Push the next value from [UnlinkedConst.ints] (a 32-bit unsigned integer) |
- * onto the stack. |
- * |
- * Note that Dart supports integers larger than 32 bits; these are |
- * represented by composing 32-bit values using the [pushLongInt] operation. |
+ * Length of the documentation comment (prior to replacing '\r\n' with '\n'). |
*/ |
- pushInt, |
+ @Id(0) |
+ @deprecated |
+ int get length; |
/** |
- * Get the number of components from [UnlinkedConst.ints], then do this number |
- * of times the following operations: multiple the current value by 2^32, "or" |
- * it with the next value in [UnlinkedConst.ints]. The initial value is zero. |
- * Push the result into the stack. |
+ * Offset of the beginning of the documentation comment relative to the |
+ * beginning of the file. |
*/ |
- pushLongInt, |
+ @Id(2) |
+ @deprecated |
+ int get offset; |
/** |
- * Push the next value from [UnlinkedConst.doubles] (a double precision |
- * floating point value) onto the stack. |
+ * Text of the documentation comment, with '\r\n' replaced by '\n'. |
+ * |
+ * References appearing within the doc comment in square brackets are not |
+ * specially encoded. |
*/ |
- pushDouble, |
+ @Id(1) |
+ String get text; |
+} |
+/** |
+ * Unlinked summary information about an enum declaration. |
+ */ |
+abstract class UnlinkedEnum extends base.SummaryClass { |
/** |
- * Push the constant `true` onto the stack. |
+ * Annotations for this enum. |
*/ |
- pushTrue, |
+ @Id(4) |
+ List<UnlinkedExpr> get annotations; |
/** |
- * Push the constant `false` onto the stack. |
+ * Code range of the enum. |
*/ |
- pushFalse, |
+ @informative |
+ @Id(5) |
+ CodeRange get codeRange; |
/** |
- * Push the next value from [UnlinkedConst.strings] onto the stack. |
+ * Documentation comment for the enum, or `null` if there is no documentation |
+ * comment. |
*/ |
- pushString, |
+ @informative |
+ @Id(3) |
+ UnlinkedDocumentationComment get documentationComment; |
/** |
- * Pop the top n values from the stack (where n is obtained from |
- * [UnlinkedConst.ints]), convert them to strings (if they aren't already), |
- * concatenate them into a single string, and push it back onto the stack. |
- * |
- * This operation is used to represent constants whose value is a literal |
- * string containing string interpolations. |
+ * Name of the enum type. |
*/ |
- concatenate, |
+ @Id(0) |
+ String get name; |
/** |
- * Get the next value from [UnlinkedConst.strings], convert it to a symbol, |
- * and push it onto the stack. |
+ * Offset of the enum name relative to the beginning of the file. |
*/ |
- makeSymbol, |
+ @informative |
+ @Id(1) |
+ int get nameOffset; |
/** |
- * Push the constant `null` onto the stack. |
+ * Values listed in the enum declaration, in declaration order. |
*/ |
- pushNull, |
+ @Id(2) |
+ List<UnlinkedEnumValue> get values; |
+} |
+/** |
+ * Unlinked summary information about a single enumerated value in an enum |
+ * declaration. |
+ */ |
+abstract class UnlinkedEnumValue extends base.SummaryClass { |
/** |
- * Push the value of the function parameter with the name obtained from |
- * [UnlinkedConst.strings]. |
+ * Documentation comment for the enum value, or `null` if there is no |
+ * documentation comment. |
*/ |
- pushParameter, |
+ @informative |
+ @Id(2) |
+ UnlinkedDocumentationComment get documentationComment; |
/** |
- * Evaluate a (potentially qualified) identifier expression and push the |
- * resulting value onto the stack. The identifier to be evaluated is |
- * obtained from [UnlinkedConst.references]. |
- * |
- * This operation is used to represent the following kinds of constants |
- * (which are indistinguishable from an unresolved AST alone): |
- * |
- * - A qualified reference to a static constant variable (e.g. `C.v`, where |
- * C is a class and `v` is a constant static variable in `C`). |
- * - An identifier expression referring to a constant variable. |
- * - A simple or qualified identifier denoting a class or type alias. |
- * - A simple or qualified identifier denoting a top-level function or a |
- * static method. |
+ * Name of the enumerated value. |
*/ |
- pushReference, |
+ @Id(0) |
+ String get name; |
/** |
- * Pop the top value from the stack, extract the value of the property with |
- * the name obtained from [UnlinkedConst.strings], and push the result back |
- * onto the stack. |
+ * Offset of the enum value name relative to the beginning of the file. |
*/ |
- extractProperty, |
+ @informative |
+ @Id(1) |
+ int get nameOffset; |
+} |
+/** |
+ * Unlinked summary information about a function, method, getter, or setter |
+ * declaration. |
+ */ |
+abstract class UnlinkedExecutable extends base.SummaryClass { |
/** |
- * Pop the top `n` values from the stack (where `n` is obtained from |
- * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
- * `n` values from [UnlinkedConst.strings] and use the lists of names and |
- * values to create named arguments. Then pop the top `m` values from the |
- * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
- * from the end) and use them as positional arguments. Use the lists of |
- * positional and names arguments to invoke a constant constructor obtained |
- * from [UnlinkedConst.references], and push the resulting value back onto the |
- * stack. |
- * |
- * Note that for an invocation of the form `const a.b(...)` (where no type |
- * arguments are specified), it is impossible to tell from the unresolved AST |
- * alone whether `a` is a class name and `b` is a constructor name, or `a` is |
- * a prefix name and `b` is a class name. For consistency between AST based |
- * and elements based summaries, references to default constructors are always |
- * recorded as references to corresponding classes. |
+ * Annotations for this executable. |
*/ |
- invokeConstructor, |
+ @Id(6) |
+ List<UnlinkedExpr> get annotations; |
/** |
- * Pop the top n values from the stack (where n is obtained from |
- * [UnlinkedConst.ints]), place them in a [List], and push the result back |
- * onto the stack. The type parameter for the [List] is implicitly `dynamic`. |
+ * If this executable's function body is declared using `=>`, the expression |
+ * to the right of the `=>`. May be omitted if neither type inference nor |
+ * constant evaluation depends on the function body. |
*/ |
- makeUntypedList, |
+ @Id(29) |
+ UnlinkedExpr get bodyExpr; |
/** |
- * Pop the top 2*n values from the stack (where n is obtained from |
- * [UnlinkedConst.ints]), interpret them as key/value pairs, place them in a |
- * [Map], and push the result back onto the stack. The two type parameters |
- * for the [Map] are implicitly `dynamic`. |
+ * Code range of the executable. |
*/ |
- makeUntypedMap, |
+ @informative |
+ @Id(26) |
+ CodeRange get codeRange; |
/** |
- * Pop the top n values from the stack (where n is obtained from |
- * [UnlinkedConst.ints]), place them in a [List], and push the result back |
- * onto the stack. The type parameter for the [List] is obtained from |
- * [UnlinkedConst.references]. |
+ * If a constant [UnlinkedExecutableKind.constructor], the constructor |
+ * initializers. Otherwise empty. |
*/ |
- makeTypedList, |
+ @Id(14) |
+ List<UnlinkedConstructorInitializer> get constantInitializers; |
/** |
- * Pop the top 2*n values from the stack (where n is obtained from |
- * [UnlinkedConst.ints]), interpret them as key/value pairs, place them in a |
- * [Map], and push the result back onto the stack. The two type parameters for |
- * the [Map] are obtained from [UnlinkedConst.references]. |
+ * If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`, |
+ * a nonzero slot id which is unique within this compilation unit. If this id |
+ * is found in [LinkedUnit.constCycles], then this constructor is part of a |
+ * cycle. |
+ * |
+ * Otherwise, zero. |
*/ |
- makeTypedMap, |
+ @Id(25) |
+ int get constCycleSlot; |
/** |
- * Pop the top 2 values from the stack, evaluate `v1 == v2`, and push the |
- * result back onto the stack. |
+ * Documentation comment for the executable, or `null` if there is no |
+ * documentation comment. |
*/ |
- equal, |
+ @informative |
+ @Id(7) |
+ UnlinkedDocumentationComment get documentationComment; |
/** |
- * Pop the top 2 values from the stack, evaluate `v1 != v2`, and push the |
- * result back onto the stack. |
+ * If this executable's return type is inferable, nonzero slot id |
+ * identifying which entry in [LinkedUnit.types] contains the inferred |
+ * return type. If there is no matching entry in [LinkedUnit.types], then |
+ * no return type was inferred for this variable, so its static type is |
+ * `dynamic`. |
*/ |
- notEqual, |
+ @Id(5) |
+ int get inferredReturnTypeSlot; |
/** |
- * Pop the top value from the stack, compute its boolean negation, and push |
- * the result back onto the stack. |
+ * Indicates whether the executable is declared using the `abstract` keyword. |
*/ |
- not, |
+ @Id(10) |
+ bool get isAbstract; |
/** |
- * Pop the top 2 values from the stack, compute `v1 && v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable has body marked as being asynchronous. |
*/ |
- and, |
+ @informative |
+ @Id(27) |
+ bool get isAsynchronous; |
/** |
- * Pop the top 2 values from the stack, compute `v1 || v2`, and push the |
- * result back onto the stack. |
- */ |
- or, |
- |
- /** |
- * Pop the top value from the stack, compute its integer complement, and push |
- * the result back onto the stack. |
- */ |
- complement, |
- |
- /** |
- * Pop the top 2 values from the stack, compute `v1 ^ v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable is declared using the `const` keyword. |
*/ |
- bitXor, |
+ @Id(12) |
+ bool get isConst; |
/** |
- * Pop the top 2 values from the stack, compute `v1 & v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable is declared using the `external` keyword. |
*/ |
- bitAnd, |
+ @Id(11) |
+ bool get isExternal; |
/** |
- * Pop the top 2 values from the stack, compute `v1 | v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable is declared using the `factory` keyword. |
*/ |
- bitOr, |
+ @Id(8) |
+ bool get isFactory; |
/** |
- * Pop the top 2 values from the stack, compute `v1 >> v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable has body marked as being a generator. |
*/ |
- bitShiftRight, |
+ @informative |
+ @Id(28) |
+ bool get isGenerator; |
/** |
- * Pop the top 2 values from the stack, compute `v1 << v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable is a redirected constructor. |
*/ |
- bitShiftLeft, |
+ @Id(13) |
+ bool get isRedirectedConstructor; |
/** |
- * Pop the top 2 values from the stack, compute `v1 + v2`, and push the |
- * result back onto the stack. |
+ * Indicates whether the executable is declared using the `static` keyword. |
+ * |
+ * Note that for top level executables, this flag is false, since they are |
+ * not declared using the `static` keyword (even though they are considered |
+ * static for semantic purposes). |
*/ |
- add, |
+ @Id(9) |
+ bool get isStatic; |
/** |
- * Pop the top value from the stack, compute its integer negation, and push |
- * the result back onto the stack. |
+ * The kind of the executable (function/method, getter, setter, or |
+ * constructor). |
*/ |
- negate, |
+ @Id(4) |
+ UnlinkedExecutableKind get kind; |
/** |
- * Pop the top 2 values from the stack, compute `v1 - v2`, and push the |
- * result back onto the stack. |
+ * The list of local functions. |
*/ |
- subtract, |
+ @Id(18) |
+ List<UnlinkedExecutable> get localFunctions; |
/** |
- * Pop the top 2 values from the stack, compute `v1 * v2`, and push the |
- * result back onto the stack. |
+ * The list of local labels. |
*/ |
- multiply, |
+ @informative |
+ @Id(22) |
+ List<UnlinkedLabel> get localLabels; |
/** |
- * Pop the top 2 values from the stack, compute `v1 / v2`, and push the |
- * result back onto the stack. |
+ * The list of local variables. |
*/ |
- divide, |
+ @informative |
+ @Id(19) |
+ List<UnlinkedVariable> get localVariables; |
/** |
- * Pop the top 2 values from the stack, compute `v1 ~/ v2`, and push the |
- * result back onto the stack. |
+ * Name of the executable. For setters, this includes the trailing "=". For |
+ * named constructors, this excludes the class name and excludes the ".". |
+ * For unnamed constructors, this is the empty string. |
*/ |
- floorDivide, |
+ @Id(1) |
+ String get name; |
/** |
- * Pop the top 2 values from the stack, compute `v1 > v2`, and push the |
- * result back onto the stack. |
+ * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
+ * the offset of the end of the constructor name. Otherwise zero. |
*/ |
- greater, |
+ @informative |
+ @Id(23) |
+ int get nameEnd; |
/** |
- * Pop the top 2 values from the stack, compute `v1 < v2`, and push the |
- * result back onto the stack. |
+ * Offset of the executable name relative to the beginning of the file. For |
+ * named constructors, this excludes the class name and excludes the ".". |
+ * For unnamed constructors, this is the offset of the class name (i.e. the |
+ * offset of the second "C" in "class C { C(); }"). |
*/ |
- less, |
+ @informative |
+ @Id(0) |
+ int get nameOffset; |
/** |
- * Pop the top 2 values from the stack, compute `v1 >= v2`, and push the |
- * result back onto the stack. |
+ * Parameters of the executable, if any. Note that getters have no |
+ * parameters (hence this will be the empty list), and setters have a single |
+ * parameter. |
*/ |
- greaterEqual, |
+ @Id(2) |
+ List<UnlinkedParam> get parameters; |
/** |
- * Pop the top 2 values from the stack, compute `v1 <= v2`, and push the |
- * result back onto the stack. |
+ * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
+ * the offset of the period before the constructor name. Otherwise zero. |
*/ |
- lessEqual, |
+ @informative |
+ @Id(24) |
+ int get periodOffset; |
/** |
- * Pop the top 2 values from the stack, compute `v1 % v2`, and push the |
- * result back onto the stack. |
+ * If [isRedirectedConstructor] and [isFactory] are both `true`, the |
+ * constructor to which this constructor redirects; otherwise empty. |
*/ |
- modulo, |
+ @Id(15) |
+ EntityRef get redirectedConstructor; |
/** |
- * Pop the top 3 values from the stack, compute `v1 ? v2 : v3`, and push the |
- * result back onto the stack. |
+ * If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the |
+ * name of the constructor that this constructor redirects to; otherwise |
+ * empty. |
*/ |
- conditional, |
+ @Id(17) |
+ String get redirectedConstructorName; |
/** |
- * Pop from the stack `value` and get the next `target` reference from |
- * [UnlinkedConst.references] - a top-level variable (prefixed or not), an |
- * assignable field of a class (prefixed or not), or a sequence of getters |
- * ending with an assignable property `a.b.b.c.d.e`. In general `a.b` cannot |
- * not be distinguished between: `a` is a prefix and `b` is a top-level |
- * variable; or `a` is an object and `b` is the name of a property. Perform |
- * `reference op= value` where `op` is the next assignment operator from |
- * [UnlinkedConst.assignmentOperators]. Push `value` back into the stack. |
- * |
- * If the assignment operator is a prefix/postfix increment/decrement, then |
- * `value` is not present in the stack, so it should not be popped and the |
- * corresponding value of the `target` after/before update is pushed into the |
- * stack instead. |
+ * Declared return type of the executable. Absent if the executable is a |
+ * constructor or the return type is implicit. Absent for executables |
+ * associated with variable initializers and closures, since these |
+ * executables may have return types that are not accessible via direct |
+ * imports. |
*/ |
- assignToRef, |
+ @Id(3) |
+ EntityRef get returnType; |
/** |
- * Pop from the stack `target` and `value`. Get the name of the property from |
- * `UnlinkedConst.strings` and assign the `value` to the named property of the |
- * `target`. This operation is used when we know that the `target` is an |
- * object reference expression, e.g. `new Foo().a.b.c` or `a.b[0].c.d`. |
- * Perform `target.property op= value` where `op` is the next assignment |
- * operator from [UnlinkedConst.assignmentOperators]. Push `value` back into |
- * the stack. |
- * |
- * If the assignment operator is a prefix/postfix increment/decrement, then |
- * `value` is not present in the stack, so it should not be popped and the |
- * corresponding value of the `target` after/before update is pushed into the |
- * stack instead. |
+ * Type parameters of the executable, if any. Empty if support for generic |
+ * method syntax is disabled. |
*/ |
- assignToProperty, |
+ @Id(16) |
+ List<UnlinkedTypeParam> get typeParameters; |
/** |
- * Pop from the stack `index`, `target` and `value`. Perform |
- * `target[index] op= value` where `op` is the next assignment operator from |
- * [UnlinkedConst.assignmentOperators]. Push `value` back into the stack. |
- * |
- * If the assignment operator is a prefix/postfix increment/decrement, then |
- * `value` is not present in the stack, so it should not be popped and the |
- * corresponding value of the `target` after/before update is pushed into the |
- * stack instead. |
+ * If a local function, the length of the visible range; zero otherwise. |
*/ |
- assignToIndex, |
+ @informative |
+ @Id(20) |
+ int get visibleLength; |
/** |
- * Pop from the stack `index` and `target`. Push into the stack the result |
- * of evaluation of `target[index]`. |
+ * If a local function, the beginning of the visible range; zero otherwise. |
*/ |
- extractIndex, |
+ @informative |
+ @Id(21) |
+ int get visibleOffset; |
+} |
+/** |
+ * Enum used to indicate the kind of an executable. |
+ */ |
+enum UnlinkedExecutableKind { |
/** |
- * Pop the top `n` values from the stack (where `n` is obtained from |
- * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
- * `n` values from [UnlinkedConst.strings] and use the lists of names and |
- * values to create named arguments. Then pop the top `m` values from the |
- * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
- * from the end) and use them as positional arguments. Use the lists of |
- * positional and names arguments to invoke a method (or a function) with |
- * the reference from [UnlinkedConst.references]. If `k` is nonzero (where |
- * `k` is obtained from [UnlinkedConst.ints]), obtain `k` type arguments from |
- * [UnlinkedConst.references] and use them as generic type arguments for the |
- * aforementioned method or function. Push the result of the invocation onto |
- * the stack. |
- * |
- * In general `a.b` cannot not be distinguished between: `a` is a prefix and |
- * `b` is a top-level function; or `a` is an object and `b` is the name of a |
- * method. This operation should be used for a sequence of identifiers |
- * `a.b.b.c.d.e` ending with an invokable result. |
+ * Executable is a function or method. |
*/ |
- invokeMethodRef, |
+ functionOrMethod, |
/** |
- * Pop the top `n` values from the stack (where `n` is obtained from |
- * [UnlinkedConst.ints]) into a list (filled from the end) and take the next |
- * `n` values from [UnlinkedConst.strings] and use the lists of names and |
- * values to create named arguments. Then pop the top `m` values from the |
- * stack (where `m` is obtained from [UnlinkedConst.ints]) into a list (filled |
- * from the end) and use them as positional arguments. Use the lists of |
- * positional and names arguments to invoke the method with the name from |
- * [UnlinkedConst.strings] of the target popped from the stack. If `k` is |
- * nonzero (where `k` is obtained from [UnlinkedConst.ints]), obtain `k` type |
- * arguments from [UnlinkedConst.references] and use them as generic type |
- * arguments for the aforementioned method. Push the result of the |
- * invocation onto the stack. |
- * |
- * This operation should be used for invocation of a method invocation |
- * where `target` is known to be an object instance. |
+ * Executable is a getter. |
*/ |
- invokeMethod, |
+ getter, |
/** |
- * Begin a new cascade section. Duplicate the top value of the stack. |
+ * Executable is a setter. |
*/ |
- cascadeSectionBegin, |
+ setter, |
/** |
- * End a new cascade section. Pop the top value from the stack and throw it |
- * away. |
+ * Executable is a constructor. |
*/ |
- cascadeSectionEnd, |
+ constructor |
+} |
+/** |
+ * Unlinked summary information about an export declaration (stored outside |
+ * [UnlinkedPublicNamespace]). |
+ */ |
+abstract class UnlinkedExportNonPublic extends base.SummaryClass { |
/** |
- * Pop the top value from the stack and cast it to the type with reference |
- * from [UnlinkedConst.references], push the result into the stack. |
+ * Annotations for this export directive. |
*/ |
- typeCast, |
+ @Id(3) |
+ List<UnlinkedExpr> get annotations; |
/** |
- * Pop the top value from the stack and check whether it is a subclass of the |
- * type with reference from [UnlinkedConst.references], push the result into |
- * the stack. |
+ * Offset of the "export" keyword. |
*/ |
- typeCheck, |
+ @informative |
+ @Id(0) |
+ int get offset; |
/** |
- * Pop the top value from the stack and raise an exception with this value. |
+ * End of the URI string (including quotes) relative to the beginning of the |
+ * file. |
*/ |
- throwException, |
+ @informative |
+ @Id(1) |
+ int get uriEnd; |
/** |
- * Obtain two values `n` and `m` from [UnlinkedConst.ints]. Then, starting at |
- * the executable element for the expression being evaluated, if n > 0, pop to |
- * the nth enclosing function element. Then, push the mth local function of |
- * that element onto the stack. |
+ * Offset of the URI string (including quotes) relative to the beginning of |
+ * the file. |
*/ |
- pushLocalFunctionReference, |
+ @informative |
+ @Id(2) |
+ int get uriOffset; |
} |
/** |
- * Unlinked summary information about a constructor initializer. |
+ * Unlinked summary information about an export declaration (stored inside |
+ * [UnlinkedPublicNamespace]). |
*/ |
-abstract class UnlinkedConstructorInitializer extends base.SummaryClass { |
- /** |
- * If there are `m` [arguments] and `n` [argumentNames], then each argument |
- * from [arguments] with index `i` such that `n + i - m >= 0`, should be used |
- * with the name at `n + i - m`. |
- */ |
- @Id(4) |
- List<String> get argumentNames; |
- |
- /** |
- * If [kind] is `thisInvocation` or `superInvocation`, the arguments of the |
- * invocation. Otherwise empty. |
- */ |
- @Id(3) |
- List<UnlinkedConst> get arguments; |
- |
+abstract class UnlinkedExportPublic extends base.SummaryClass { |
/** |
- * If [kind] is `field`, the expression of the field initializer. |
- * Otherwise `null`. |
+ * Combinators contained in this export declaration. |
*/ |
@Id(1) |
- UnlinkedConst get expression; |
+ List<UnlinkedCombinator> get combinators; |
/** |
- * The kind of the constructor initializer (field, redirect, super). |
+ * Configurations used to control which library will actually be loaded at |
+ * run-time. |
*/ |
@Id(2) |
- UnlinkedConstructorInitializerKind get kind; |
+ List<UnlinkedConfiguration> get configurations; |
/** |
- * If [kind] is `field`, the name of the field declared in the class. If |
- * [kind] is `thisInvocation`, the name of the constructor, declared in this |
- * class, to redirect to. If [kind] is `superInvocation`, the name of the |
- * constructor, declared in the superclass, to invoke. |
+ * URI used in the source code to reference the exported library. |
*/ |
@Id(0) |
- String get name; |
+ String get uri; |
} |
/** |
- * Enum used to indicate the kind of an constructor initializer. |
+ * Unlinked summary information about an expression. |
+ * |
+ * Expressions are represented using a simple stack-based language |
+ * where [operations] is a sequence of operations to execute starting with an |
+ * empty stack. Once all operations have been executed, the stack should |
+ * contain a single value which is the value of the constant. Note that some |
+ * operations consume additional data from the other fields of this class. |
*/ |
-enum UnlinkedConstructorInitializerKind { |
+abstract class UnlinkedExpr extends base.SummaryClass { |
/** |
- * Initialization of a field. |
+ * Sequence of operators used by assignment operations. |
*/ |
- field, |
+ @Id(6) |
+ List<UnlinkedExprAssignOperator> get assignmentOperators; |
/** |
- * Invocation of a constructor in the same class. |
+ * Sequence of 64-bit doubles consumed by the operation `pushDouble`. |
*/ |
- thisInvocation, |
+ @Id(4) |
+ List<double> get doubles; |
/** |
- * Invocation of a superclass' constructor. |
+ * Sequence of unsigned 32-bit integers consumed by the operations |
+ * `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`, |
+ * `makeList`, and `makeMap`. |
*/ |
- superInvocation |
-} |
+ @Id(1) |
+ List<int> get ints; |
-/** |
- * Unlinked summary information about a documentation comment. |
- */ |
-abstract class UnlinkedDocumentationComment extends base.SummaryClass { |
/** |
- * Length of the documentation comment (prior to replacing '\r\n' with '\n'). |
+ * Indicates whether the expression is a valid potentially constant |
+ * expression. |
+ */ |
+ @Id(5) |
+ bool get isValidConst; |
+ |
+ /** |
+ * Sequence of operations to execute (starting with an empty stack) to form |
+ * the constant value. |
*/ |
@Id(0) |
- @deprecated |
- int get length; |
+ List<UnlinkedExprOperation> get operations; |
/** |
- * Offset of the beginning of the documentation comment relative to the |
- * beginning of the file. |
+ * Sequence of language constructs consumed by the operations |
+ * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note |
+ * that in the case of `pushReference` (and sometimes `invokeConstructor` the |
+ * actual entity being referred to may be something other than a type. |
*/ |
@Id(2) |
- @deprecated |
- int get offset; |
+ List<EntityRef> get references; |
/** |
- * Text of the documentation comment, with '\r\n' replaced by '\n'. |
- * |
- * References appearing within the doc comment in square brackets are not |
- * specially encoded. |
+ * Sequence of strings consumed by the operations `pushString` and |
+ * `invokeConstructor`. |
*/ |
- @Id(1) |
- String get text; |
+ @Id(3) |
+ List<String> get strings; |
} |
/** |
- * Unlinked summary information about an enum declaration. |
+ * Enum representing the various kinds of assignment operations combined |
+ * with: |
+ * [UnlinkedExprOperation.assignToRef], |
+ * [UnlinkedExprOperation.assignToProperty], |
+ * [UnlinkedExprOperation.assignToIndex]. |
*/ |
-abstract class UnlinkedEnum extends base.SummaryClass { |
+enum UnlinkedExprAssignOperator { |
/** |
- * Annotations for this enum. |
+ * Perform simple assignment `target = operand`. |
*/ |
- @Id(4) |
- List<UnlinkedConst> get annotations; |
+ assign, |
+ |
+ /** |
+ * Perform `target ??= operand`. |
+ */ |
+ ifNull, |
+ |
+ /** |
+ * Perform `target *= operand`. |
+ */ |
+ multiply, |
/** |
- * Code range of the enum. |
+ * Perform `target /= operand`. |
*/ |
- @informative |
- @Id(5) |
- CodeRange get codeRange; |
+ divide, |
/** |
- * Documentation comment for the enum, or `null` if there is no documentation |
- * comment. |
+ * Perform `target ~/= operand`. |
*/ |
- @informative |
- @Id(3) |
- UnlinkedDocumentationComment get documentationComment; |
+ floorDivide, |
/** |
- * Name of the enum type. |
+ * Perform `target %= operand`. |
*/ |
- @Id(0) |
- String get name; |
+ modulo, |
/** |
- * Offset of the enum name relative to the beginning of the file. |
+ * Perform `target += operand`. |
*/ |
- @informative |
- @Id(1) |
- int get nameOffset; |
+ plus, |
/** |
- * Values listed in the enum declaration, in declaration order. |
+ * Perform `target -= operand`. |
*/ |
- @Id(2) |
- List<UnlinkedEnumValue> get values; |
-} |
+ minus, |
-/** |
- * Unlinked summary information about a single enumerated value in an enum |
- * declaration. |
- */ |
-abstract class UnlinkedEnumValue extends base.SummaryClass { |
/** |
- * Documentation comment for the enum value, or `null` if there is no |
- * documentation comment. |
+ * Perform `target <<= operand`. |
*/ |
- @informative |
- @Id(2) |
- UnlinkedDocumentationComment get documentationComment; |
+ shiftLeft, |
/** |
- * Name of the enumerated value. |
+ * Perform `target >>= operand`. |
*/ |
- @Id(0) |
- String get name; |
+ shiftRight, |
/** |
- * Offset of the enum value name relative to the beginning of the file. |
+ * Perform `target &= operand`. |
*/ |
- @informative |
- @Id(1) |
- int get nameOffset; |
-} |
+ bitAnd, |
-/** |
- * Unlinked summary information about a function, method, getter, or setter |
- * declaration. |
- */ |
-abstract class UnlinkedExecutable extends base.SummaryClass { |
/** |
- * Annotations for this executable. |
+ * Perform `target ^= operand`. |
*/ |
- @Id(6) |
- List<UnlinkedConst> get annotations; |
+ bitXor, |
/** |
- * If this executable's function body is declared using `=>`, the expression |
- * to the right of the `=>`. May be omitted if neither type inference nor |
- * constant evaluation depends on the function body. |
+ * Perform `target |= operand`. |
*/ |
- @Id(29) |
- UnlinkedConst get bodyExpr; |
+ bitOr, |
/** |
- * Code range of the executable. |
+ * Perform `++target`. |
*/ |
- @informative |
- @Id(26) |
- CodeRange get codeRange; |
+ prefixIncrement, |
/** |
- * If a constant [UnlinkedExecutableKind.constructor], the constructor |
- * initializers. Otherwise empty. |
+ * Perform `--target`. |
*/ |
- @Id(14) |
- List<UnlinkedConstructorInitializer> get constantInitializers; |
+ prefixDecrement, |
/** |
- * If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`, |
- * a nonzero slot id which is unique within this compilation unit. If this id |
- * is found in [LinkedUnit.constCycles], then this constructor is part of a |
- * cycle. |
- * |
- * Otherwise, zero. |
+ * Perform `target++`. |
*/ |
- @Id(25) |
- int get constCycleSlot; |
+ postfixIncrement, |
/** |
- * Documentation comment for the executable, or `null` if there is no |
- * documentation comment. |
+ * Perform `target++`. |
*/ |
- @informative |
- @Id(7) |
- UnlinkedDocumentationComment get documentationComment; |
+ postfixDecrement, |
+} |
+/** |
+ * Enum representing the various kinds of operations which may be performed to |
+ * in an expression. These options are assumed to execute in the |
+ * context of a stack which is initially empty. |
+ */ |
+enum UnlinkedExprOperation { |
/** |
- * If this executable's return type is inferable, nonzero slot id |
- * identifying which entry in [LinkedUnit.types] contains the inferred |
- * return type. If there is no matching entry in [LinkedUnit.types], then |
- * no return type was inferred for this variable, so its static type is |
- * `dynamic`. |
+ * Push the next value from [UnlinkedExpr.ints] (a 32-bit unsigned integer) |
+ * onto the stack. |
+ * |
+ * Note that Dart supports integers larger than 32 bits; these are |
+ * represented by composing 32-bit values using the [pushLongInt] operation. |
*/ |
- @Id(5) |
- int get inferredReturnTypeSlot; |
+ pushInt, |
/** |
- * Indicates whether the executable is declared using the `abstract` keyword. |
+ * Get the number of components from [UnlinkedExpr.ints], then do this number |
+ * of times the following operations: multiple the current value by 2^32, "or" |
+ * it with the next value in [UnlinkedExpr.ints]. The initial value is zero. |
+ * Push the result into the stack. |
*/ |
- @Id(10) |
- bool get isAbstract; |
+ pushLongInt, |
/** |
- * Indicates whether the executable has body marked as being asynchronous. |
+ * Push the next value from [UnlinkedExpr.doubles] (a double precision |
+ * floating point value) onto the stack. |
*/ |
- @informative |
- @Id(27) |
- bool get isAsynchronous; |
+ pushDouble, |
/** |
- * Indicates whether the executable is declared using the `const` keyword. |
+ * Push the constant `true` onto the stack. |
*/ |
- @Id(12) |
- bool get isConst; |
+ pushTrue, |
/** |
- * Indicates whether the executable is declared using the `external` keyword. |
+ * Push the constant `false` onto the stack. |
*/ |
- @Id(11) |
- bool get isExternal; |
+ pushFalse, |
/** |
- * Indicates whether the executable is declared using the `factory` keyword. |
+ * Push the next value from [UnlinkedExpr.strings] onto the stack. |
*/ |
- @Id(8) |
- bool get isFactory; |
+ pushString, |
/** |
- * Indicates whether the executable has body marked as being a generator. |
+ * Pop the top n values from the stack (where n is obtained from |
+ * [UnlinkedExpr.ints]), convert them to strings (if they aren't already), |
+ * concatenate them into a single string, and push it back onto the stack. |
+ * |
+ * This operation is used to represent constants whose value is a literal |
+ * string containing string interpolations. |
*/ |
- @informative |
- @Id(28) |
- bool get isGenerator; |
+ concatenate, |
/** |
- * Indicates whether the executable is a redirected constructor. |
+ * Get the next value from [UnlinkedExpr.strings], convert it to a symbol, |
+ * and push it onto the stack. |
*/ |
- @Id(13) |
- bool get isRedirectedConstructor; |
+ makeSymbol, |
/** |
- * Indicates whether the executable is declared using the `static` keyword. |
- * |
- * Note that for top level executables, this flag is false, since they are |
- * not declared using the `static` keyword (even though they are considered |
- * static for semantic purposes). |
+ * Push the constant `null` onto the stack. |
*/ |
- @Id(9) |
- bool get isStatic; |
+ pushNull, |
/** |
- * The kind of the executable (function/method, getter, setter, or |
- * constructor). |
+ * Push the value of the function parameter with the name obtained from |
+ * [UnlinkedExpr.strings]. |
*/ |
- @Id(4) |
- UnlinkedExecutableKind get kind; |
+ pushParameter, |
/** |
- * The list of local functions. |
+ * Evaluate a (potentially qualified) identifier expression and push the |
+ * resulting value onto the stack. The identifier to be evaluated is |
+ * obtained from [UnlinkedExpr.references]. |
+ * |
+ * This operation is used to represent the following kinds of constants |
+ * (which are indistinguishable from an unresolved AST alone): |
+ * |
+ * - A qualified reference to a static constant variable (e.g. `C.v`, where |
+ * C is a class and `v` is a constant static variable in `C`). |
+ * - An identifier expression referring to a constant variable. |
+ * - A simple or qualified identifier denoting a class or type alias. |
+ * - A simple or qualified identifier denoting a top-level function or a |
+ * static method. |
*/ |
- @Id(18) |
- List<UnlinkedExecutable> get localFunctions; |
+ pushReference, |
/** |
- * The list of local labels. |
+ * Pop the top value from the stack, extract the value of the property with |
+ * the name obtained from [UnlinkedExpr.strings], and push the result back |
+ * onto the stack. |
*/ |
- @informative |
- @Id(22) |
- List<UnlinkedLabel> get localLabels; |
+ extractProperty, |
/** |
- * The list of local variables. |
+ * Pop the top `n` values from the stack (where `n` is obtained from |
+ * [UnlinkedExpr.ints]) into a list (filled from the end) and take the next |
+ * `n` values from [UnlinkedExpr.strings] and use the lists of names and |
+ * values to create named arguments. Then pop the top `m` values from the |
+ * stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled |
+ * from the end) and use them as positional arguments. Use the lists of |
+ * positional and names arguments to invoke a constant constructor obtained |
+ * from [UnlinkedExpr.references], and push the resulting value back onto the |
+ * stack. |
+ * |
+ * Note that for an invocation of the form `const a.b(...)` (where no type |
+ * arguments are specified), it is impossible to tell from the unresolved AST |
+ * alone whether `a` is a class name and `b` is a constructor name, or `a` is |
+ * a prefix name and `b` is a class name. For consistency between AST based |
+ * and elements based summaries, references to default constructors are always |
+ * recorded as references to corresponding classes. |
*/ |
- @informative |
- @Id(19) |
- List<UnlinkedVariable> get localVariables; |
+ invokeConstructor, |
/** |
- * Name of the executable. For setters, this includes the trailing "=". For |
- * named constructors, this excludes the class name and excludes the ".". |
- * For unnamed constructors, this is the empty string. |
+ * Pop the top n values from the stack (where n is obtained from |
+ * [UnlinkedExpr.ints]), place them in a [List], and push the result back |
+ * onto the stack. The type parameter for the [List] is implicitly `dynamic`. |
*/ |
- @Id(1) |
- String get name; |
+ makeUntypedList, |
/** |
- * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
- * the offset of the end of the constructor name. Otherwise zero. |
+ * Pop the top 2*n values from the stack (where n is obtained from |
+ * [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a |
+ * [Map], and push the result back onto the stack. The two type parameters |
+ * for the [Map] are implicitly `dynamic`. |
*/ |
- @informative |
- @Id(23) |
- int get nameEnd; |
+ makeUntypedMap, |
/** |
- * Offset of the executable name relative to the beginning of the file. For |
- * named constructors, this excludes the class name and excludes the ".". |
- * For unnamed constructors, this is the offset of the class name (i.e. the |
- * offset of the second "C" in "class C { C(); }"). |
+ * Pop the top n values from the stack (where n is obtained from |
+ * [UnlinkedExpr.ints]), place them in a [List], and push the result back |
+ * onto the stack. The type parameter for the [List] is obtained from |
+ * [UnlinkedExpr.references]. |
*/ |
- @informative |
- @Id(0) |
- int get nameOffset; |
+ makeTypedList, |
/** |
- * Parameters of the executable, if any. Note that getters have no |
- * parameters (hence this will be the empty list), and setters have a single |
- * parameter. |
+ * Pop the top 2*n values from the stack (where n is obtained from |
+ * [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a |
+ * [Map], and push the result back onto the stack. The two type parameters for |
+ * the [Map] are obtained from [UnlinkedExpr.references]. |
*/ |
- @Id(2) |
- List<UnlinkedParam> get parameters; |
+ makeTypedMap, |
/** |
- * If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty, |
- * the offset of the period before the constructor name. Otherwise zero. |
+ * Pop the top 2 values from the stack, evaluate `v1 == v2`, and push the |
+ * result back onto the stack. |
*/ |
- @informative |
- @Id(24) |
- int get periodOffset; |
+ equal, |
/** |
- * If [isRedirectedConstructor] and [isFactory] are both `true`, the |
- * constructor to which this constructor redirects; otherwise empty. |
+ * Pop the top 2 values from the stack, evaluate `v1 != v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(15) |
- EntityRef get redirectedConstructor; |
+ notEqual, |
/** |
- * If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the |
- * name of the constructor that this constructor redirects to; otherwise |
- * empty. |
+ * Pop the top value from the stack, compute its boolean negation, and push |
+ * the result back onto the stack. |
*/ |
- @Id(17) |
- String get redirectedConstructorName; |
+ not, |
/** |
- * Declared return type of the executable. Absent if the executable is a |
- * constructor or the return type is implicit. Absent for executables |
- * associated with variable initializers and closures, since these |
- * executables may have return types that are not accessible via direct |
- * imports. |
+ * Pop the top 2 values from the stack, compute `v1 && v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(3) |
- EntityRef get returnType; |
+ and, |
/** |
- * Type parameters of the executable, if any. Empty if support for generic |
- * method syntax is disabled. |
+ * Pop the top 2 values from the stack, compute `v1 || v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(16) |
- List<UnlinkedTypeParam> get typeParameters; |
+ or, |
/** |
- * If a local function, the length of the visible range; zero otherwise. |
+ * Pop the top value from the stack, compute its integer complement, and push |
+ * the result back onto the stack. |
*/ |
- @informative |
- @Id(20) |
- int get visibleLength; |
+ complement, |
/** |
- * If a local function, the beginning of the visible range; zero otherwise. |
+ * Pop the top 2 values from the stack, compute `v1 ^ v2`, and push the |
+ * result back onto the stack. |
*/ |
- @informative |
- @Id(21) |
- int get visibleOffset; |
-} |
+ bitXor, |
-/** |
- * Enum used to indicate the kind of an executable. |
- */ |
-enum UnlinkedExecutableKind { |
/** |
- * Executable is a function or method. |
+ * Pop the top 2 values from the stack, compute `v1 & v2`, and push the |
+ * result back onto the stack. |
*/ |
- functionOrMethod, |
+ bitAnd, |
/** |
- * Executable is a getter. |
+ * Pop the top 2 values from the stack, compute `v1 | v2`, and push the |
+ * result back onto the stack. |
*/ |
- getter, |
+ bitOr, |
/** |
- * Executable is a setter. |
+ * Pop the top 2 values from the stack, compute `v1 >> v2`, and push the |
+ * result back onto the stack. |
*/ |
- setter, |
+ bitShiftRight, |
/** |
- * Executable is a constructor. |
+ * Pop the top 2 values from the stack, compute `v1 << v2`, and push the |
+ * result back onto the stack. |
*/ |
- constructor |
-} |
+ bitShiftLeft, |
-/** |
- * Unlinked summary information about an export declaration (stored outside |
- * [UnlinkedPublicNamespace]). |
- */ |
-abstract class UnlinkedExportNonPublic extends base.SummaryClass { |
/** |
- * Annotations for this export directive. |
+ * Pop the top 2 values from the stack, compute `v1 + v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(3) |
- List<UnlinkedConst> get annotations; |
+ add, |
/** |
- * Offset of the "export" keyword. |
+ * Pop the top value from the stack, compute its integer negation, and push |
+ * the result back onto the stack. |
*/ |
- @informative |
- @Id(0) |
- int get offset; |
+ negate, |
/** |
- * End of the URI string (including quotes) relative to the beginning of the |
- * file. |
+ * Pop the top 2 values from the stack, compute `v1 - v2`, and push the |
+ * result back onto the stack. |
*/ |
- @informative |
- @Id(1) |
- int get uriEnd; |
+ subtract, |
/** |
- * Offset of the URI string (including quotes) relative to the beginning of |
- * the file. |
+ * Pop the top 2 values from the stack, compute `v1 * v2`, and push the |
+ * result back onto the stack. |
*/ |
- @informative |
- @Id(2) |
- int get uriOffset; |
-} |
+ multiply, |
-/** |
- * Unlinked summary information about an export declaration (stored inside |
- * [UnlinkedPublicNamespace]). |
- */ |
-abstract class UnlinkedExportPublic extends base.SummaryClass { |
/** |
- * Combinators contained in this export declaration. |
+ * Pop the top 2 values from the stack, compute `v1 / v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(1) |
- List<UnlinkedCombinator> get combinators; |
+ divide, |
/** |
- * Configurations used to control which library will actually be loaded at |
- * run-time. |
+ * Pop the top 2 values from the stack, compute `v1 ~/ v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(2) |
- List<UnlinkedConfiguration> get configurations; |
+ floorDivide, |
/** |
- * URI used in the source code to reference the exported library. |
+ * Pop the top 2 values from the stack, compute `v1 > v2`, and push the |
+ * result back onto the stack. |
*/ |
- @Id(0) |
- String get uri; |
-} |
+ greater, |
-/** |
- * Enum representing the various kinds of assignment operations combined |
- * with: |
- * [UnlinkedConstOperation.assignToRef], |
- * [UnlinkedConstOperation.assignToProperty], |
- * [UnlinkedConstOperation.assignToIndex]. |
- */ |
-enum UnlinkedExprAssignOperator { |
/** |
- * Perform simple assignment `target = operand`. |
+ * Pop the top 2 values from the stack, compute `v1 < v2`, and push the |
+ * result back onto the stack. |
*/ |
- assign, |
+ less, |
/** |
- * Perform `target ??= operand`. |
+ * Pop the top 2 values from the stack, compute `v1 >= v2`, and push the |
+ * result back onto the stack. |
*/ |
- ifNull, |
+ greaterEqual, |
/** |
- * Perform `target *= operand`. |
+ * Pop the top 2 values from the stack, compute `v1 <= v2`, and push the |
+ * result back onto the stack. |
*/ |
- multiply, |
+ lessEqual, |
/** |
- * Perform `target /= operand`. |
+ * Pop the top 2 values from the stack, compute `v1 % v2`, and push the |
+ * result back onto the stack. |
*/ |
- divide, |
+ modulo, |
/** |
- * Perform `target ~/= operand`. |
+ * Pop the top 3 values from the stack, compute `v1 ? v2 : v3`, and push the |
+ * result back onto the stack. |
*/ |
- floorDivide, |
+ conditional, |
/** |
- * Perform `target %= operand`. |
+ * Pop from the stack `value` and get the next `target` reference from |
+ * [UnlinkedExpr.references] - a top-level variable (prefixed or not), an |
+ * assignable field of a class (prefixed or not), or a sequence of getters |
+ * ending with an assignable property `a.b.b.c.d.e`. In general `a.b` cannot |
+ * not be distinguished between: `a` is a prefix and `b` is a top-level |
+ * variable; or `a` is an object and `b` is the name of a property. Perform |
+ * `reference op= value` where `op` is the next assignment operator from |
+ * [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack. |
+ * |
+ * If the assignment operator is a prefix/postfix increment/decrement, then |
+ * `value` is not present in the stack, so it should not be popped and the |
+ * corresponding value of the `target` after/before update is pushed into the |
+ * stack instead. |
*/ |
- modulo, |
+ assignToRef, |
/** |
- * Perform `target += operand`. |
+ * Pop from the stack `target` and `value`. Get the name of the property from |
+ * `UnlinkedConst.strings` and assign the `value` to the named property of the |
+ * `target`. This operation is used when we know that the `target` is an |
+ * object reference expression, e.g. `new Foo().a.b.c` or `a.b[0].c.d`. |
+ * Perform `target.property op= value` where `op` is the next assignment |
+ * operator from [UnlinkedExpr.assignmentOperators]. Push `value` back into |
+ * the stack. |
+ * |
+ * If the assignment operator is a prefix/postfix increment/decrement, then |
+ * `value` is not present in the stack, so it should not be popped and the |
+ * corresponding value of the `target` after/before update is pushed into the |
+ * stack instead. |
*/ |
- plus, |
+ assignToProperty, |
/** |
- * Perform `target -= operand`. |
+ * Pop from the stack `index`, `target` and `value`. Perform |
+ * `target[index] op= value` where `op` is the next assignment operator from |
+ * [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack. |
+ * |
+ * If the assignment operator is a prefix/postfix increment/decrement, then |
+ * `value` is not present in the stack, so it should not be popped and the |
+ * corresponding value of the `target` after/before update is pushed into the |
+ * stack instead. |
*/ |
- minus, |
+ assignToIndex, |
/** |
- * Perform `target <<= operand`. |
+ * Pop from the stack `index` and `target`. Push into the stack the result |
+ * of evaluation of `target[index]`. |
*/ |
- shiftLeft, |
+ extractIndex, |
/** |
- * Perform `target >>= operand`. |
+ * Pop the top `n` values from the stack (where `n` is obtained from |
+ * [UnlinkedExpr.ints]) into a list (filled from the end) and take the next |
+ * `n` values from [UnlinkedExpr.strings] and use the lists of names and |
+ * values to create named arguments. Then pop the top `m` values from the |
+ * stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled |
+ * from the end) and use them as positional arguments. Use the lists of |
+ * positional and names arguments to invoke a method (or a function) with |
+ * the reference from [UnlinkedExpr.references]. If `k` is nonzero (where |
+ * `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type arguments from |
+ * [UnlinkedExpr.references] and use them as generic type arguments for the |
+ * aforementioned method or function. Push the result of the invocation onto |
+ * the stack. |
+ * |
+ * In general `a.b` cannot not be distinguished between: `a` is a prefix and |
+ * `b` is a top-level function; or `a` is an object and `b` is the name of a |
+ * method. This operation should be used for a sequence of identifiers |
+ * `a.b.b.c.d.e` ending with an invokable result. |
*/ |
- shiftRight, |
+ invokeMethodRef, |
/** |
- * Perform `target &= operand`. |
+ * Pop the top `n` values from the stack (where `n` is obtained from |
+ * [UnlinkedExpr.ints]) into a list (filled from the end) and take the next |
+ * `n` values from [UnlinkedExpr.strings] and use the lists of names and |
+ * values to create named arguments. Then pop the top `m` values from the |
+ * stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled |
+ * from the end) and use them as positional arguments. Use the lists of |
+ * positional and names arguments to invoke the method with the name from |
+ * [UnlinkedExpr.strings] of the target popped from the stack. If `k` is |
+ * nonzero (where `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type |
+ * arguments from [UnlinkedExpr.references] and use them as generic type |
+ * arguments for the aforementioned method. Push the result of the |
+ * invocation onto the stack. |
+ * |
+ * This operation should be used for invocation of a method invocation |
+ * where `target` is known to be an object instance. |
*/ |
- bitAnd, |
+ invokeMethod, |
/** |
- * Perform `target ^= operand`. |
+ * Begin a new cascade section. Duplicate the top value of the stack. |
*/ |
- bitXor, |
+ cascadeSectionBegin, |
/** |
- * Perform `target |= operand`. |
+ * End a new cascade section. Pop the top value from the stack and throw it |
+ * away. |
*/ |
- bitOr, |
+ cascadeSectionEnd, |
/** |
- * Perform `++target`. |
+ * Pop the top value from the stack and cast it to the type with reference |
+ * from [UnlinkedExpr.references], push the result into the stack. |
*/ |
- prefixIncrement, |
+ typeCast, |
/** |
- * Perform `--target`. |
+ * Pop the top value from the stack and check whether it is a subclass of the |
+ * type with reference from [UnlinkedExpr.references], push the result into |
+ * the stack. |
*/ |
- prefixDecrement, |
+ typeCheck, |
/** |
- * Perform `target++`. |
+ * Pop the top value from the stack and raise an exception with this value. |
*/ |
- postfixIncrement, |
+ throwException, |
/** |
- * Perform `target++`. |
+ * Obtain two values `n` and `m` from [UnlinkedExpr.ints]. Then, starting at |
+ * the executable element for the expression being evaluated, if n > 0, pop to |
+ * the nth enclosing function element. Then, push the mth local function of |
+ * that element onto the stack. |
*/ |
- postfixDecrement, |
+ pushLocalFunctionReference, |
} |
/** |
@@ -2175,7 +2174,7 @@ abstract class UnlinkedImport extends base.SummaryClass { |
* Annotations for this import declaration. |
*/ |
@Id(8) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Combinators contained in this import declaration. |
@@ -2289,7 +2288,7 @@ abstract class UnlinkedParam extends base.SummaryClass { |
* Annotations for this parameter. |
*/ |
@Id(9) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Code range of the parameter. |
@@ -2427,7 +2426,7 @@ abstract class UnlinkedPart extends base.SummaryClass { |
* Annotations for this part declaration. |
*/ |
@Id(2) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* End of the URI string (including quotes) relative to the beginning of the |
@@ -2551,7 +2550,7 @@ abstract class UnlinkedTypedef extends base.SummaryClass { |
* Annotations for this typedef. |
*/ |
@Id(4) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Code range of the typedef. |
@@ -2608,7 +2607,7 @@ abstract class UnlinkedTypeParam extends base.SummaryClass { |
* Annotations for this type parameter. |
*/ |
@Id(3) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Bound of the type parameter, if a bound is explicitly declared. Otherwise |
@@ -2713,7 +2712,7 @@ abstract class UnlinkedUnit extends base.SummaryClass { |
* library declaration. |
*/ |
@Id(14) |
- List<UnlinkedConst> get libraryAnnotations; |
+ List<UnlinkedExpr> get libraryAnnotations; |
/** |
* Documentation comment for the library, or `null` if there is no |
@@ -2796,7 +2795,7 @@ abstract class UnlinkedVariable extends base.SummaryClass { |
* Annotations for this variable. |
*/ |
@Id(8) |
- List<UnlinkedConst> get annotations; |
+ List<UnlinkedExpr> get annotations; |
/** |
* Code range of the variable. |