| Index: pkg/analyzer/lib/src/generated/constant.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
|
| index ae9ce66d7c1f82f4db5bf1c4ef6239265ae0db8c..690adc180d7a24c62807d1163ed6369063b14c8c 100644
|
| --- a/pkg/analyzer/lib/src/generated/constant.dart
|
| +++ b/pkg/analyzer/lib/src/generated/constant.dart
|
| @@ -23,8 +23,7 @@ import 'utilities_collection.dart';
|
| import 'utilities_dart.dart' show ParameterKind;
|
|
|
| /**
|
| - * Instances of the class `BoolState` represent the state of an object representing a boolean
|
| - * value.
|
| + * The state of an object representing a boolean value.
|
| */
|
| class BoolState extends InstanceState {
|
| /**
|
| @@ -48,9 +47,7 @@ class BoolState extends InstanceState {
|
| final bool value;
|
|
|
| /**
|
| - * Initialize a newly created state to represent the given value.
|
| - *
|
| - * @param value the value of this instance
|
| + * Initialize a newly created state to represent the given [value].
|
| */
|
| BoolState(this.value);
|
|
|
| @@ -60,11 +57,6 @@ class BoolState extends InstanceState {
|
| @override
|
| int get hashCode => value == null ? 0 : (value ? 2 : 3);
|
|
|
| - /**
|
| - * Return `true` if this object represents an object whose type is 'bool'.
|
| - *
|
| - * @return `true` if this object represents a boolean value
|
| - */
|
| @override
|
| bool get isBool => true;
|
|
|
| @@ -145,56 +137,66 @@ class BoolState extends InstanceState {
|
| String toString() => value == null ? "-unknown-" : (value ? "true" : "false");
|
|
|
| /**
|
| - * Return the boolean state representing the given boolean value.
|
| - *
|
| - * @param value the value to be represented
|
| - * @return the boolean state representing the given boolean value
|
| + * Return the boolean state representing the given boolean [value].
|
| */
|
| static BoolState from(bool value) =>
|
| value ? BoolState.TRUE_STATE : BoolState.FALSE_STATE;
|
| }
|
|
|
| /**
|
| - * Instances of the class `ConstantEvaluator` evaluate constant expressions to produce their
|
| - * compile-time value. According to the Dart Language Specification: <blockquote> A constant
|
| - * expression is one of the following:
|
| + * Instances of the class `ConstantEvaluator` evaluate constant expressions to
|
| + * produce their compile-time value. According to the Dart Language
|
| + * Specification:
|
| + * <blockquote>
|
| + * A constant expression is one of the following:
|
| * * A literal number.
|
| * * A literal boolean.
|
| - * * A literal string where any interpolated expression is a compile-time constant that evaluates
|
| - * to a numeric, string or boolean value or to <b>null</b>.
|
| + * * A literal string where any interpolated expression is a compile-time
|
| + * constant that evaluates to a numeric, string or boolean value or to
|
| + * <b>null</b>.
|
| * * A literal symbol.
|
| * * <b>null</b>.
|
| * * A qualified reference to a static constant variable.
|
| - * * An identifier expression that denotes a constant variable, class or type alias.
|
| + * * An identifier expression that denotes a constant variable, class or type
|
| + * alias.
|
| * * A constant constructor invocation.
|
| * * A constant list literal.
|
| * * A constant map literal.
|
| - * * A simple or qualified identifier denoting a top-level function or a static method.
|
| - * * A parenthesized expression <i>(e)</i> where <i>e</i> is a constant expression.
|
| - * * An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i> where
|
| - * <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions and <i>identical()</i> is
|
| - * statically bound to the predefined dart function <i>identical()</i> discussed above.
|
| - * * An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i> or <i>e<sub>1</sub>
|
| - * != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions
|
| - * that evaluate to a numeric, string or boolean value.
|
| - * * An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> && e<sub>2</sub></i> or
|
| - * <i>e<sub>1</sub> || e<sub>2</sub></i>, where <i>e</i>, <i>e1</sub></i> and <i>e2</sub></i> are
|
| - * constant expressions that evaluate to a boolean value.
|
| - * * An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^ e<sub>2</sub></i>,
|
| - * <i>e<sub>1</sub> & e<sub>2</sub></i>, <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub>
|
| - * >> e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where <i>e</i>,
|
| - * <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions that evaluate to an
|
| - * integer value or to <b>null</b>.
|
| - * * An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> + e<sub>2</sub></i>,
|
| - * <i>e<sub>1</sub> -e<sub>2</sub></i>, <i>e<sub>1</sub> * e<sub>2</sub></i>, <i>e<sub>1</sub> /
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ e<sub>2</sub></i>, <i>e<sub>1</sub> >
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >=
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or <i>e<sub>1</sub> %
|
| - * e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| - * expressions that evaluate to a numeric value or to <b>null</b>.
|
| - * * An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> : e<sub>3</sub></i> where
|
| - * <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and <i>e<sub>3</sub></i> are constant expressions, and
|
| - * <i>e<sub>1</sub></i> evaluates to a boolean value.
|
| + * * A simple or qualified identifier denoting a top-level function or a static
|
| + * method.
|
| + * * A parenthesized expression <i>(e)</i> where <i>e</i> is a constant
|
| + * expression.
|
| + * * An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i>
|
| + * where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| + * expressions and <i>identical()</i> is statically bound to the predefined
|
| + * dart function <i>identical()</i> discussed above.
|
| + * * An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i> or
|
| + * <i>e<sub>1</sub> != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and
|
| + * <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric,
|
| + * string or boolean value.
|
| + * * An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> &&
|
| + * e<sub>2</sub></i> or <i>e<sub>1</sub> || e<sub>2</sub></i>, where <i>e</i>,
|
| + * <i>e1</sub></i> and <i>e2</sub></i> are constant expressions that evaluate
|
| + * to a boolean value.
|
| + * * An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> & e<sub>2</sub></i>,
|
| + * <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub> >>
|
| + * e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where
|
| + * <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| + * expressions that evaluate to an integer value or to <b>null</b>.
|
| + * * An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> +
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> -e<sub>2</sub></i>, <i>e<sub>1</sub> *
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> / e<sub>2</sub></i>, <i>e<sub>1</sub>
|
| + * ~/ e<sub>2</sub></i>, <i>e<sub>1</sub> > e<sub>2</sub></i>,
|
| + * <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >=
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or
|
| + * <i>e<sub>1</sub> % e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i>
|
| + * and <i>e<sub>2</sub></i> are constant expressions that evaluate to a
|
| + * numeric value or to <b>null</b>.
|
| + * * An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> :
|
| + * e<sub>3</sub></i> where <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and
|
| + * <i>e<sub>3</sub></i> are constant expressions, and <i>e<sub>1</sub></i>
|
| + * evaluates to a boolean value.
|
| * </blockquote>
|
| */
|
| class ConstantEvaluator {
|
| @@ -209,10 +211,9 @@ class ConstantEvaluator {
|
| final TypeProvider _typeProvider;
|
|
|
| /**
|
| - * Initialize a newly created evaluator to evaluate expressions in the given source.
|
| - *
|
| - * @param source the source containing the expression(s) that will be evaluated
|
| - * @param typeProvider the type provider used to access known types
|
| + * Initialize a newly created evaluator to evaluate expressions in the given
|
| + * [source]. The [typeProvider] is the type provider used to access known
|
| + * types.
|
| */
|
| ConstantEvaluator(this._source, this._typeProvider);
|
|
|
| @@ -229,20 +230,22 @@ class ConstantEvaluator {
|
| }
|
|
|
| /**
|
| - * Instances of the class `ConstantFinder` are used to traverse the AST
|
| - * structures of all of the compilation units being resolved and build tables
|
| - * of the constant variables, constant constructors, constant constructor
|
| - * invocations, and annotations found in those compilation units.
|
| + * A visitor used to traverse the AST structures of all of the compilation units
|
| + * being resolved and build tables of the constant variables, constant
|
| + * constructors, constant constructor invocations, and annotations found in
|
| + * those compilation units.
|
| */
|
| class ConstantFinder extends RecursiveAstVisitor<Object> {
|
| /**
|
| - * A table mapping constant variable elements to the declarations of those variables.
|
| + * A table mapping constant variable elements to the declarations of those
|
| + * variables.
|
| */
|
| final HashMap<VariableElement, VariableDeclaration> variableMap =
|
| new HashMap<VariableElement, VariableDeclaration>();
|
|
|
| /**
|
| - * A table mapping constant constructors to the declarations of those constructors.
|
| + * A table mapping constant constructors to the declarations of those
|
| + * constructors.
|
| */
|
| final HashMap<ConstructorElement, ConstructorDeclaration> constructorMap =
|
| new HashMap<ConstructorElement, ConstructorDeclaration>();
|
| @@ -301,11 +304,11 @@ class ConstantFinder extends RecursiveAstVisitor<Object> {
|
| }
|
|
|
| /**
|
| - * Instances of the class `ConstantValueComputer` compute the values of constant variables and
|
| - * constant constructor invocations in one or more compilation units. The expected usage pattern is
|
| - * for the compilation units to be added to this computer using the method
|
| - * [add] and then for the method [computeValues] to be invoked
|
| - * exactly once. Any use of an instance after invoking the method [computeValues] will
|
| + * An object used to compute the values of constant variables and constant
|
| + * constructor invocations in one or more compilation units. The expected usage
|
| + * pattern is for the compilation units to be added to this computer using the
|
| + * method [add] and then for the method [computeValues] to be invoked exactly
|
| + * once. Any use of an instance after invoking the method [computeValues] will
|
| * result in unpredictable behavior.
|
| */
|
| class ConstantValueComputer {
|
| @@ -315,25 +318,29 @@ class ConstantValueComputer {
|
| static String _DEFAULT_VALUE_PARAM = "defaultValue";
|
|
|
| /**
|
| - * Source of RegExp matching declarable operator names. From sdk/lib/internal/symbol.dart.
|
| + * Source of RegExp matching declarable operator names.
|
| + * From sdk/lib/internal/symbol.dart.
|
| */
|
| static String _OPERATOR_RE =
|
| "(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)";
|
|
|
| /**
|
| - * Source of RegExp matching any public identifier. From sdk/lib/internal/symbol.dart.
|
| + * Source of RegExp matching any public identifier.
|
| + * From sdk/lib/internal/symbol.dart.
|
| */
|
| static String _PUBLIC_IDENTIFIER_RE =
|
| "(?!${ConstantValueComputer._RESERVED_WORD_RE}\\b(?!\\\$))[a-zA-Z\$][\\w\$]*";
|
|
|
| /**
|
| - * Source of RegExp matching Dart reserved words. From sdk/lib/internal/symbol.dart.
|
| + * Source of RegExp matching Dart reserved words.
|
| + * From sdk/lib/internal/symbol.dart.
|
| */
|
| static String _RESERVED_WORD_RE =
|
| "(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|v(?:ar|oid)|w(?:hile|ith))";
|
|
|
| /**
|
| - * RegExp that validates a non-empty non-private symbol. From sdk/lib/internal/symbol.dart.
|
| + * RegExp that validates a non-empty non-private symbol.
|
| + * From sdk/lib/internal/symbol.dart.
|
| */
|
| static RegExp _PUBLIC_SYMBOL_PATTERN = new RegExp(
|
| "^(?:${ConstantValueComputer._OPERATOR_RE}\$|$_PUBLIC_IDENTIFIER_RE(?:=?\$|[.](?!\$)))+?\$");
|
| @@ -344,14 +351,14 @@ class ConstantValueComputer {
|
| TypeProvider typeProvider;
|
|
|
| /**
|
| - * The object used to find constant variables and constant constructor invocations in the
|
| - * compilation units that were added.
|
| + * The object used to find constant variables and constant constructor
|
| + * invocations in the compilation units that were added.
|
| */
|
| ConstantFinder _constantFinder = new ConstantFinder();
|
|
|
| /**
|
| - * A graph in which the nodes are the constants, and the edges are from each constant to the other
|
| - * constants that are referenced by it.
|
| + * A graph in which the nodes are the constants, and the edges are from each
|
| + * constant to the other constants that are referenced by it.
|
| */
|
| DirectedGraph<AstNode> referenceGraph = new DirectedGraph<AstNode>();
|
|
|
| @@ -361,7 +368,8 @@ class ConstantValueComputer {
|
| HashMap<VariableElement, VariableDeclaration> _variableDeclarationMap;
|
|
|
| /**
|
| - * A table mapping constant constructors to the declarations of those constructors.
|
| + * A table mapping constant constructors to the declarations of those
|
| + * constructors.
|
| */
|
| HashMap<ConstructorElement, ConstructorDeclaration> constructorDeclarationMap;
|
|
|
| @@ -381,46 +389,45 @@ class ConstantValueComputer {
|
| final DeclaredVariables _declaredVariables;
|
|
|
| /**
|
| - * Initialize a newly created constant value computer.
|
| - *
|
| - * @param typeProvider the type provider used to access known types
|
| - * @param declaredVariables the set of variables declared on the command line using '-D'
|
| + * Initialize a newly created constant value computer. The [typeProvider] is
|
| + * the type provider used to access known types. The [declaredVariables] is
|
| + * the set of variables declared on the command line using '-D'.
|
| */
|
| ConstantValueComputer(TypeProvider typeProvider, this._declaredVariables) {
|
| this.typeProvider = typeProvider;
|
| }
|
|
|
| /**
|
| - * Add the constants in the given compilation unit to the list of constants whose value needs to
|
| - * be computed.
|
| - *
|
| - * @param unit the compilation unit defining the constants to be added
|
| + * Add the constants in the given compilation [unit] to the list of constants
|
| + * whose value needs to be computed.
|
| */
|
| void add(CompilationUnit unit) {
|
| unit.accept(_constantFinder);
|
| }
|
|
|
| /**
|
| - * This method is called just before computing the constant value associated with an AST node.
|
| - * Unit tests will override this method to introduce additional error checking.
|
| + * This method is called just before computing the constant value associated
|
| + * with [constNode]. Unit tests will override this method to introduce
|
| + * additional error checking.
|
| */
|
| void beforeComputeValue(AstNode constNode) {}
|
|
|
| /**
|
| - * This method is called just before getting the constant initializers associated with a
|
| - * constructor AST node. Unit tests will override this method to introduce additional error
|
| - * checking.
|
| + * This method is called just before getting the constant initializers
|
| + * associated with the [constructor]. Unit tests will override this method to
|
| + * introduce additional error checking.
|
| */
|
| void beforeGetConstantInitializers(ConstructorElement constructor) {}
|
|
|
| /**
|
| - * This method is called just before getting a parameter's default value. Unit tests will override
|
| - * this method to introduce additional error checking.
|
| + * This method is called just before getting a parameter's default value. Unit
|
| + * tests will override this method to introduce additional error checking.
|
| */
|
| void beforeGetParameterDefault(ParameterElement parameter) {}
|
|
|
| /**
|
| - * Compute values for all of the constants in the compilation units that were added.
|
| + * Compute values for all of the constants in the compilation units that were
|
| + * added.
|
| */
|
| void computeValues() {
|
| _variableDeclarationMap = _constantFinder.variableMap;
|
| @@ -513,8 +520,8 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Create the ConstantVisitor used to evaluate constants. Unit tests will override this method to
|
| - * introduce additional error checking.
|
| + * Create the ConstantVisitor used to evaluate constants. Unit tests will
|
| + * override this method to introduce additional error checking.
|
| */
|
| ConstantVisitor createConstantVisitor(ErrorReporter errorReporter) =>
|
| new ConstantVisitor.con1(typeProvider, errorReporter);
|
| @@ -524,14 +531,13 @@ class ConstantValueComputer {
|
| constructorDeclarationMap[_getConstructorBase(constructor)];
|
|
|
| /**
|
| - * Check that the arguments to a call to fromEnvironment() are correct.
|
| - *
|
| - * @param arguments the AST nodes of the arguments.
|
| - * @param argumentValues the values of the unnamed arguments.
|
| - * @param namedArgumentValues the values of the named arguments.
|
| - * @param expectedDefaultValueType the allowed type of the "defaultValue" parameter (if present).
|
| - * Note: "defaultValue" is always allowed to be null.
|
| - * @return true if the arguments are correct, false if there is an error.
|
| + * Check that the arguments to a call to fromEnvironment() are correct. The
|
| + * [arguments] are the AST nodes of the arguments. The [argumentValues] are
|
| + * the values of the unnamed arguments. The [namedArgumentValues] are the
|
| + * values of the named arguments. The [expectedDefaultValueType] is the
|
| + * allowed type of the "defaultValue" parameter (if present). Note:
|
| + * "defaultValue" is always allowed to be null. Return `true` if the arguments
|
| + * are correct, `false` if there is an error.
|
| */
|
| bool _checkFromEnvironmentArguments(NodeList<Expression> arguments,
|
| List<DartObjectImpl> argumentValues,
|
| @@ -566,12 +572,11 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Check that the arguments to a call to Symbol() are correct.
|
| - *
|
| - * @param arguments the AST nodes of the arguments.
|
| - * @param argumentValues the values of the unnamed arguments.
|
| - * @param namedArgumentValues the values of the named arguments.
|
| - * @return true if the arguments are correct, false if there is an error.
|
| + * Check that the arguments to a call to Symbol() are correct. The [arguments]
|
| + * are the AST nodes of the arguments. The [argumentValues] are the values of
|
| + * the unnamed arguments. The [namedArgumentValues] are the values of the
|
| + * named arguments. Return `true` if the arguments are correct, `false` if
|
| + * there is an error.
|
| */
|
| bool _checkSymbolArguments(NodeList<Expression> arguments,
|
| List<DartObjectImpl> argumentValues,
|
| @@ -590,9 +595,7 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Compute a value for the given constant.
|
| - *
|
| - * @param constNode the constant for which a value is to be computed
|
| + * Compute a value for the given [constNode].
|
| */
|
| void _computeValueFor(AstNode constNode) {
|
| beforeComputeValue(constNode);
|
| @@ -701,13 +704,13 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Evaluate a call to fromEnvironment() on the bool, int, or String class.
|
| - *
|
| - * @param environmentValue Value fetched from the environment
|
| - * @param builtInDefaultValue Value that should be used as the default if no "defaultValue"
|
| - * argument appears in [namedArgumentValues].
|
| - * @param namedArgumentValues Named parameters passed to fromEnvironment()
|
| - * @return A [DartObjectImpl] object corresponding to the evaluated result
|
| + * Evaluate a call to fromEnvironment() on the bool, int, or String class. The
|
| + * [environmentValue] is the value fetched from the environment. The
|
| + * [builtInDefaultValue] is the value that should be used as the default if no
|
| + * "defaultValue" argument appears in [namedArgumentValues]. The
|
| + * [namedArgumentValues] are the values of the named parameters passed to
|
| + * fromEnvironment(). Return a [DartObjectImpl] object corresponding to the
|
| + * evaluated result.
|
| */
|
| DartObjectImpl _computeValueFromEnvironment(DartObject environmentValue,
|
| DartObjectImpl builtInDefaultValue,
|
| @@ -971,13 +974,12 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Attempt to follow the chain of factory redirections until a constructor is reached which is not
|
| - * a const factory constructor.
|
| - *
|
| - * @return the constant constructor which terminates the chain of factory redirections, if the
|
| - * chain terminates. If there is a problem (e.g. a redirection can't be found, or a cycle
|
| - * is encountered), the chain will be followed as far as possible and then a const factory
|
| - * constructor will be returned.
|
| + * Attempt to follow the chain of factory redirections until a constructor is
|
| + * reached which is not a const factory constructor. Return the constant
|
| + * constructor which terminates the chain of factory redirections, if the
|
| + * chain terminates. If there is a problem (e.g. a redirection can't be found,
|
| + * or a cycle is encountered), the chain will be followed as far as possible
|
| + * and then a const factory constructor will be returned.
|
| */
|
| ConstructorElement _followConstantRedirectionChain(
|
| ConstructorElement constructor) {
|
| @@ -1018,14 +1020,12 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Generate an error indicating that the given constant is not a valid compile-time constant
|
| - * because it references at least one of the constants in the given cycle, each of which directly
|
| - * or indirectly references the constant.
|
| - *
|
| - * @param constantsInCycle the constants in the cycle that includes the given constant
|
| - * @param constant the constant that is not a valid compile-time constant
|
| + * Generate an error indicating that the given [constant] is not a valid
|
| + * compile-time constant because it references at least one of the constants
|
| + * in the given [cycle], each of which directly or indirectly references the
|
| + * constant.
|
| */
|
| - void _generateCycleError(List<AstNode> constantsInCycle, AstNode constant) {
|
| + void _generateCycleError(List<AstNode> cycle, AstNode constant) {
|
| // TODO(brianwilkerson) Implement this.
|
| }
|
|
|
| @@ -1037,8 +1037,8 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Check if the object [obj] matches the type [type] according
|
| - * to runtime type checking rules.
|
| + * Check if the object [obj] matches the type [type] according to runtime type
|
| + * checking rules.
|
| */
|
| bool _runtimeTypeMatch(DartObjectImpl obj, DartType type) {
|
| if (obj.isNull) {
|
| @@ -1051,8 +1051,8 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * Determine whether the given string is a valid name for a public symbol (i.e. whether it is
|
| - * allowed for a call to the Symbol constructor).
|
| + * Determine whether the given string is a valid name for a public symbol
|
| + * (i.e. whether it is allowed for a call to the Symbol constructor).
|
| */
|
| static bool isValidPublicSymbol(String name) => name.isEmpty ||
|
| name == "void" ||
|
| @@ -1060,9 +1060,8 @@ class ConstantValueComputer {
|
| }
|
|
|
| /**
|
| - * A `ConstantValueComputer_InitializerCloner` is an [AstCloner] that copies the
|
| - * necessary information from the AST to allow const constructor initializers to
|
| - * be evaluated.
|
| + * An [AstCloner] that copies the necessary information from the AST to allow
|
| + * const constructor initializers to be evaluated.
|
| */
|
| class ConstantValueComputer_InitializerCloner extends AstCloner {
|
| // TODO(brianwilkerson) Investigate replacing uses of this class with uses of
|
| @@ -1106,46 +1105,58 @@ class ConstantValueComputer_InitializerCloner extends AstCloner {
|
| }
|
|
|
| /**
|
| - * Instances of the class `ConstantVisitor` evaluate constant expressions to produce their
|
| - * compile-time value. According to the Dart Language Specification: <blockquote> A constant
|
| + * A visitor used to evaluate constant expressions to produce their compile-time
|
| + * value. According to the Dart Language Specification: <blockquote> A constant
|
| * expression is one of the following:
|
| + *
|
| * * A literal number.
|
| * * A literal boolean.
|
| - * * A literal string where any interpolated expression is a compile-time constant that evaluates
|
| - * to a numeric, string or boolean value or to <b>null</b>.
|
| + * * A literal string where any interpolated expression is a compile-time
|
| + * constant that evaluates to a numeric, string or boolean value or to
|
| + * <b>null</b>.
|
| * * A literal symbol.
|
| * * <b>null</b>.
|
| * * A qualified reference to a static constant variable.
|
| - * * An identifier expression that denotes a constant variable, class or type alias.
|
| + * * An identifier expression that denotes a constant variable, class or type
|
| + * alias.
|
| * * A constant constructor invocation.
|
| * * A constant list literal.
|
| * * A constant map literal.
|
| - * * A simple or qualified identifier denoting a top-level function or a static method.
|
| - * * A parenthesized expression <i>(e)</i> where <i>e</i> is a constant expression.
|
| - * * An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i> where
|
| - * <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions and <i>identical()</i> is
|
| - * statically bound to the predefined dart function <i>identical()</i> discussed above.
|
| - * * An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i> or <i>e<sub>1</sub>
|
| - * != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions
|
| - * that evaluate to a numeric, string or boolean value.
|
| - * * An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> && e<sub>2</sub></i> or
|
| - * <i>e<sub>1</sub> || e<sub>2</sub></i>, where <i>e</i>, <i>e1</sub></i> and <i>e2</sub></i> are
|
| - * constant expressions that evaluate to a boolean value.
|
| - * * An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^ e<sub>2</sub></i>,
|
| - * <i>e<sub>1</sub> & e<sub>2</sub></i>, <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub>
|
| - * >> e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where <i>e</i>,
|
| - * <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions that evaluate to an
|
| - * integer value or to <b>null</b>.
|
| - * * An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> + e<sub>2</sub></i>,
|
| - * <i>e<sub>1</sub> - e<sub>2</sub></i>, <i>e<sub>1</sub> * e<sub>2</sub></i>, <i>e<sub>1</sub> /
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ e<sub>2</sub></i>, <i>e<sub>1</sub> >
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >=
|
| - * e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or <i>e<sub>1</sub> %
|
| - * e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| - * expressions that evaluate to a numeric value or to <b>null</b>.
|
| - * * An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> : e<sub>3</sub></i> where
|
| - * <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and <i>e<sub>3</sub></i> are constant expressions, and
|
| - * <i>e<sub>1</sub></i> evaluates to a boolean value.
|
| + * * A simple or qualified identifier denoting a top-level function or a static
|
| + * method.
|
| + * * A parenthesized expression <i>(e)</i> where <i>e</i> is a constant
|
| + * expression.
|
| + * * An expression of the form <i>identical(e<sub>1</sub>, e<sub>2</sub>)</i>
|
| + * where <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| + * expressions and <i>identical()</i> is statically bound to the predefined
|
| + * dart function <i>identical()</i> discussed above.
|
| + * * An expression of one of the forms <i>e<sub>1</sub> == e<sub>2</sub></i> or
|
| + * <i>e<sub>1</sub> != e<sub>2</sub></i> where <i>e<sub>1</sub></i> and
|
| + * <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric,
|
| + * string or boolean value.
|
| + * * An expression of one of the forms <i>!e</i>, <i>e<sub>1</sub> &&
|
| + * e<sub>2</sub></i> or <i>e<sub>1</sub> || e<sub>2</sub></i>, where <i>e</i>,
|
| + * <i>e1</sub></i> and <i>e2</sub></i> are constant expressions that evaluate
|
| + * to a boolean value.
|
| + * * An expression of one of the forms <i>~e</i>, <i>e<sub>1</sub> ^
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> & e<sub>2</sub></i>,
|
| + * <i>e<sub>1</sub> | e<sub>2</sub></i>, <i>e<sub>1</sub> >>
|
| + * e<sub>2</sub></i> or <i>e<sub>1</sub> << e<sub>2</sub></i>, where
|
| + * <i>e</i>, <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant
|
| + * expressions that evaluate to an integer value or to <b>null</b>.
|
| + * * An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> +
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> - e<sub>2</sub></i>, <i>e<sub>1</sub> *
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> / e<sub>2</sub></i>, <i>e<sub>1</sub>
|
| + * ~/ e<sub>2</sub></i>, <i>e<sub>1</sub> > e<sub>2</sub></i>,
|
| + * <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >=
|
| + * e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or
|
| + * <i>e<sub>1</sub> % e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i>
|
| + * and <i>e<sub>2</sub></i> are constant expressions that evaluate to a
|
| + * numeric value or to <b>null</b>.
|
| + * * An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> :
|
| + * e<sub>3</sub></i> where <i>e<sub>1</sub></i>, <i>e<sub>2</sub></i> and
|
| + * <i>e<sub>3</sub></i> are constant expressions, and <i>e<sub>1</sub></i>
|
| + * evaluates to a boolean value.
|
| * </blockquote>
|
| */
|
| class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| @@ -1162,7 +1173,8 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| HashMap<String, DartObjectImpl> _lexicalEnvironment;
|
|
|
| /**
|
| - * Error reporter that we use to report errors accumulated while computing the constant.
|
| + * Error reporter that we use to report errors accumulated while computing the
|
| + * constant.
|
| */
|
| final ErrorReporter _errorReporter;
|
|
|
| @@ -1172,11 +1184,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| DartObjectComputer _dartObjectComputer;
|
|
|
| /**
|
| - * Initialize a newly created constant visitor.
|
| - *
|
| - * @param typeProvider the type provider used to access known types
|
| - * @param lexicalEnvironment values which should override simpleIdentifiers, or null if no
|
| - * overriding is necessary.
|
| + * Initialize a newly created constant visitor. The [_typeProvider] is the
|
| + * type provider used to access known types. The [_errorReporter] is used to
|
| + * report errors found during evaluation.
|
| */
|
| ConstantVisitor.con1(this._typeProvider, this._errorReporter) {
|
| this._lexicalEnvironment = null;
|
| @@ -1185,11 +1195,11 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * Initialize a newly created constant visitor.
|
| - *
|
| - * @param typeProvider the type provider used to access known types
|
| - * @param lexicalEnvironment values which should override simpleIdentifiers, or null if no
|
| - * overriding is necessary.
|
| + * Initialize a newly created constant visitor. The [_typeProvider] is the
|
| + * type provider used to access known types. The [lexicalEnvironment] is a map
|
| + * containing values which should override identifiers, or `null` if no
|
| + * overriding is necessary. The [_errorReporter] is used to report errors
|
| + * found during evaluation.
|
| */
|
| ConstantVisitor.con2(this._typeProvider,
|
| HashMap<String, DartObjectImpl> lexicalEnvironment, this._errorReporter) {
|
| @@ -1200,8 +1210,6 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
|
|
| /**
|
| * Return an object representing the value 'null'.
|
| - *
|
| - * @return an object representing the value 'null'
|
| */
|
| DartObjectImpl get null2 {
|
| if (_nullObject == null) {
|
| @@ -1212,14 +1220,15 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * This method is called just before retrieving an evaluation result from an AST node. Unit tests
|
| - * will override it to introduce additional error checking.
|
| + * This method is called just before retrieving an evaluation result from an
|
| + * AST node. Unit tests will override it to introduce additional error
|
| + * checking.
|
| */
|
| void beforeGetEvaluationResult(AstNode node) {}
|
|
|
| /**
|
| * Return `true` if the given [element] represents the `length` getter in
|
| - * class [String].
|
| + * class 'String'.
|
| */
|
| bool isStringLength(Element element) {
|
| if (element is PropertyAccessorElement) {
|
| @@ -1602,10 +1611,8 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * Create an error associated with the given node.
|
| - *
|
| - * @param node the AST node associated with the error
|
| - * @param code the error code indicating the nature of the error
|
| + * Create an error associated with the given [node]. The error will have the
|
| + * given error [code].
|
| */
|
| void _error(AstNode node, ErrorCode code) {
|
| _errorReporter.reportErrorForNode(
|
| @@ -1613,11 +1620,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * Return the constant value of the static constant represented by the given element.
|
| - *
|
| - * @param node the node to be used if an error needs to be reported
|
| - * @param element the element whose value is to be returned
|
| - * @return the constant value of the static constant
|
| + * Return the constant value of the static constant represented by the given
|
| + * [element]. The [node] is the node to be used if an error needs to be
|
| + * reported.
|
| */
|
| DartObjectImpl _getConstantValue(AstNode node, Element element) {
|
| if (element is PropertyAccessorElement) {
|
| @@ -1664,11 +1669,8 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * Return the value of the given expression, or a representation of 'null' if the expression
|
| - * cannot be evaluated.
|
| - *
|
| - * @param expression the expression whose value is to be returned
|
| - * @return the value of the given expression
|
| + * Return the value of the given [expression], or a representation of 'null'
|
| + * if the expression cannot be evaluated.
|
| */
|
| DartObjectImpl _valueOf(Expression expression) {
|
| DartObjectImpl expressionValue = expression.accept(this);
|
| @@ -1680,90 +1682,69 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
|
| }
|
|
|
| /**
|
| - * The interface `DartObject` defines the behavior of objects that represent the state of a
|
| - * Dart object.
|
| + * The state of a Dart object.
|
| */
|
| abstract class DartObject {
|
| /**
|
| - * Return the boolean value of this object, or `null` if either the value of this object is
|
| - * not known or this object is not of type 'bool'.
|
| - *
|
| - * @return the boolean value of this object
|
| + * Return the boolean value of this object, or `null` if either the value of
|
| + * this object is not known or this object is not of type 'bool'.
|
| */
|
| bool get boolValue;
|
|
|
| /**
|
| - * Return the floating point value of this object, or `null` if either the value of this
|
| - * object is not known or this object is not of type 'double'.
|
| - *
|
| - * @return the floating point value of this object
|
| + * Return the floating point value of this object, or `null` if either the
|
| + * value of this object is not known or this object is not of type 'double'.
|
| */
|
| double get doubleValue;
|
|
|
| /**
|
| * Return `true` if this object's value can be represented exactly.
|
| - *
|
| - * @return `true` if this object's value can be represented exactly
|
| */
|
| bool get hasExactValue;
|
|
|
| /**
|
| - * Return the integer value of this object, or `null` if either the value of this object is
|
| - * not known or this object is not of type 'int'.
|
| - *
|
| - * @return the integer value of this object
|
| + * Return the integer value of this object, or `null` if either the value of
|
| + * this object is not known or this object is not of type 'int'.
|
| */
|
| int get intValue;
|
|
|
| /**
|
| * Return `true` if this object represents the value 'false'.
|
| - *
|
| - * @return `true` if this object represents the value 'false'
|
| */
|
| bool get isFalse;
|
|
|
| /**
|
| * Return `true` if this object represents the value 'null'.
|
| - *
|
| - * @return `true` if this object represents the value 'null'
|
| */
|
| bool get isNull;
|
|
|
| /**
|
| * Return `true` if this object represents the value 'true'.
|
| - *
|
| - * @return `true` if this object represents the value 'true'
|
| */
|
| bool get isTrue;
|
|
|
| /**
|
| - * Return the string value of this object, or `null` if either the value of this object is
|
| - * not known or this object is not of type 'String'.
|
| - *
|
| - * @return the string value of this object
|
| + * Return the string value of this object, or `null` if either the value of
|
| + * this object is not known or this object is not of type 'String'.
|
| */
|
| String get stringValue;
|
|
|
| /**
|
| * Return the run-time type of this object.
|
| - *
|
| - * @return the run-time type of this object
|
| */
|
| ParameterizedType get type;
|
|
|
| /**
|
| - * Return this object's value if it can be represented exactly, or `null` if either the
|
| - * value cannot be represented exactly or if the value is `null`. Clients should use
|
| - * [hasExactValue] to distinguish between these two cases.
|
| - *
|
| - * @return this object's value
|
| + * Return this object's value if it can be represented exactly, or `null` if
|
| + * either the value cannot be represented exactly or if the value is `null`.
|
| + * Clients should use [hasExactValue] to distinguish between these two cases.
|
| */
|
| Object get value;
|
| }
|
|
|
| /**
|
| - * Instances of the class `DartObjectComputer` contain methods for manipulating instances of a
|
| - * Dart class and for collecting errors during evaluation.
|
| + * A utility class that contains methods for manipulating instances of a Dart
|
| + * class and for collecting errors during evaluation.
|
| */
|
| class DartObjectComputer {
|
| /**
|
| @@ -1772,8 +1753,8 @@ class DartObjectComputer {
|
| final ErrorReporter _errorReporter;
|
|
|
| /**
|
| - * The type provider. Used to create objects of the appropriate types, and to identify when an
|
| - * object is of a built-in type.
|
| + * The type provider used to create objects of the appropriate types, and to
|
| + * identify when an object is of a built-in type.
|
| */
|
| final TypeProvider _typeProvider;
|
|
|
| @@ -1793,10 +1774,8 @@ class DartObjectComputer {
|
| }
|
|
|
| /**
|
| - * Return the result of applying boolean conversion to this result.
|
| - *
|
| - * @param node the node against which errors should be reported
|
| - * @return the result of applying boolean conversion to the given value
|
| + * Return the result of applying boolean conversion to the [evaluationResult].
|
| + * The [node] is the node against which errors should be reported.
|
| */
|
| DartObjectImpl applyBooleanConversion(
|
| AstNode node, DartObjectImpl evaluationResult) {
|
| @@ -2084,10 +2063,9 @@ class DartObjectComputer {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the 'length' getter on this result.
|
| - *
|
| - * @param node the node against which errors should be reported
|
| - * @return the result of invoking the 'length' getter on this result
|
| + * Return the result of invoking the 'length' getter on the
|
| + * [evaluationResult]. The [node] is the node against which errors should be
|
| + * reported.
|
| */
|
| EvaluationResultImpl stringLength(
|
| Expression node, EvaluationResultImpl evaluationResult) {
|
| @@ -2116,7 +2094,7 @@ class DartObjectComputer {
|
| }
|
|
|
| /**
|
| - * Instances of the class `DartObjectImpl` represent an instance of a Dart class.
|
| + * An instance of a Dart class.
|
| */
|
| class DartObjectImpl implements DartObject {
|
| /**
|
| @@ -2135,10 +2113,7 @@ class DartObjectImpl implements DartObject {
|
| final InstanceState _state;
|
|
|
| /**
|
| - * Initialize a newly created object to have the given type and state.
|
| - *
|
| - * @param type the run-time type of this object
|
| - * @param state the state of the object
|
| + * Initialize a newly created object to have the given [type] and [_state].
|
| */
|
| DartObjectImpl(this.type, this._state);
|
|
|
| @@ -2176,16 +2151,12 @@ class DartObjectImpl implements DartObject {
|
|
|
| /**
|
| * Return `true` if this object represents an object whose type is 'bool'.
|
| - *
|
| - * @return `true` if this object represents a boolean value
|
| */
|
| bool get isBool => _state.isBool;
|
|
|
| /**
|
| - * Return `true` if this object represents an object whose type is either 'bool', 'num',
|
| - * 'String', or 'Null'.
|
| - *
|
| - * @return `true` if this object represents either a boolean, numeric, string or null value
|
| + * Return `true` if this object represents an object whose type is either
|
| + * 'bool', 'num', 'String', or 'Null'.
|
| */
|
| bool get isBoolNumStringOrNull => _state.isBoolNumStringOrNull;
|
|
|
| @@ -2201,14 +2172,13 @@ class DartObjectImpl implements DartObject {
|
| _state is BoolState && identical((_state as BoolState).value, true);
|
|
|
| /**
|
| - * Return true if this object represents an unknown value.
|
| + * Return `true` if this object represents an unknown value.
|
| */
|
| bool get isUnknown => _state.isUnknown;
|
|
|
| /**
|
| - * Return `true` if this object represents an instance of a user-defined class.
|
| - *
|
| - * @return `true` if this object represents an instance of a user-defined class
|
| + * Return `true` if this object represents an instance of a user-defined
|
| + * class.
|
| */
|
| bool get isUserDefinedObject => _state is GenericState;
|
|
|
| @@ -2233,12 +2203,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '+' operator on this object with the given argument.
|
| + * Return the result of invoking the '+' operator on this object with the
|
| + * given [rightOperand]. The [typeProvider] is the type provider used to find
|
| + * known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '+' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl add(TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| InstanceState result = _state.add(rightOperand._state);
|
| @@ -2256,12 +2226,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '&' operator on this object with the given argument.
|
| + * Return the result of invoking the '&' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '&' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl bitAnd(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2269,22 +2239,22 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.intType, _state.bitAnd(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '~' operator on this object.
|
| + * Return the result of invoking the '~' operator on this object. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of invoking the '~' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl bitNot(TypeProvider typeProvider) =>
|
| new DartObjectImpl(typeProvider.intType, _state.bitNot());
|
|
|
| /**
|
| - * Return the result of invoking the '|' operator on this object with the given argument.
|
| + * Return the result of invoking the '|' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '|' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl bitOr(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2292,12 +2262,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.intType, _state.bitOr(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '^' operator on this object with the given argument.
|
| + * Return the result of invoking the '^' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '^' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl bitXor(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2305,12 +2275,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.intType, _state.bitXor(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the ' ' operator on this object with the given argument.
|
| + * Return the result of invoking the ' ' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the ' ' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl concatenate(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2318,11 +2288,11 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.stringType, _state.concatenate(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of applying boolean conversion to this object.
|
| + * Return the result of applying boolean conversion to this object. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of applying boolean conversion to this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl convertToBool(TypeProvider typeProvider) {
|
| InterfaceType boolType = typeProvider.boolType;
|
| @@ -2333,12 +2303,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '/' operator on this object with the given argument.
|
| + * Return the result of invoking the '/' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '/' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for
|
| + * an object of this kind.
|
| */
|
| DartObjectImpl divide(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| @@ -2355,12 +2325,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '==' operator on this object with the given argument.
|
| + * Return the result of invoking the '==' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '==' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl equalEqual(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| @@ -2382,12 +2352,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '>' operator on this object with the given argument.
|
| + * Return the result of invoking the '>' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl greaterThan(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2395,24 +2365,24 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.boolType, _state.greaterThan(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '>=' operator on this object with the given argument.
|
| + * Return the result of invoking the '>=' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>=' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl greaterThanOrEqual(TypeProvider typeProvider,
|
| DartObjectImpl rightOperand) => new DartObjectImpl(
|
| typeProvider.boolType, _state.greaterThanOrEqual(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '~/' operator on this object with the given argument.
|
| + * Return the result of invoking the '~/' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '~/' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl integerDivide(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2421,12 +2391,8 @@ class DartObjectImpl implements DartObject {
|
|
|
| /**
|
| * Return the result of invoking the identical function on this object with
|
| - * the given argument.
|
| - *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the identical function on this object with
|
| - * the given argument
|
| + * the [rightOperand]. The [typeProvider] is the type provider used to find
|
| + * known types.
|
| */
|
| DartObjectImpl isIdentical(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| @@ -2435,12 +2401,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '<' operator on this object with the given argument.
|
| + * Return the result of invoking the '<' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl lessThan(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2448,12 +2414,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.boolType, _state.lessThan(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '<=' operator on this object with the given argument.
|
| + * Return the result of invoking the '<=' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<=' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl lessThanOrEqual(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2461,12 +2427,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.boolType, _state.lessThanOrEqual(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '&&' operator on this object with the given argument.
|
| + * Return the result of invoking the '&&' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '&&' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl logicalAnd(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2474,22 +2440,22 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.boolType, _state.logicalAnd(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '!' operator on this object.
|
| + * Return the result of invoking the '!' operator on this object. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of invoking the '!' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl logicalNot(TypeProvider typeProvider) =>
|
| new DartObjectImpl(typeProvider.boolType, _state.logicalNot());
|
|
|
| /**
|
| - * Return the result of invoking the '||' operator on this object with the given argument.
|
| + * Return the result of invoking the '||' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '||' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl logicalOr(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2497,12 +2463,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.boolType, _state.logicalOr(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '-' operator on this object with the given argument.
|
| + * Return the result of invoking the '-' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '-' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl minus(TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| InstanceState result = _state.minus(rightOperand._state);
|
| @@ -2518,11 +2484,11 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '-' operator on this object.
|
| + * Return the result of invoking the '-' operator on this object. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of invoking the '-' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl negated(TypeProvider typeProvider) {
|
| InstanceState result = _state.negated();
|
| @@ -2538,12 +2504,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '!=' operator on this object with the given argument.
|
| + * Return the result of invoking the '!=' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '!=' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl notEqual(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| @@ -2562,11 +2528,11 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of converting this object to a String.
|
| + * Return the result of converting this object to a 'String'. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of converting this object to a String
|
| - * @throws EvaluationException if the object cannot be converted to a String
|
| + * Throws an [EvaluationException] if the object cannot be converted to a
|
| + * 'String'.
|
| */
|
| DartObjectImpl performToString(TypeProvider typeProvider) {
|
| InterfaceType stringType = typeProvider.stringType;
|
| @@ -2577,12 +2543,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '%' operator on this object with the given argument.
|
| + * Return the result of invoking the '%' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '%' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl remainder(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| @@ -2600,12 +2566,12 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '<<' operator on this object with the given argument.
|
| + * Return the result of invoking the '<<' operator on this object with
|
| + * the [rightOperand]. The [typeProvider] is the type provider used to find
|
| + * known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<<' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl shiftLeft(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2613,12 +2579,12 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.intType, _state.shiftLeft(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the '>>' operator on this object with the given argument.
|
| + * Return the result of invoking the '>>' operator on this object with
|
| + * the [rightOperand]. The [typeProvider] is the type provider used to find
|
| + * known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>>' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl shiftRight(
|
| TypeProvider typeProvider, DartObjectImpl rightOperand) =>
|
| @@ -2626,22 +2592,22 @@ class DartObjectImpl implements DartObject {
|
| typeProvider.intType, _state.shiftRight(rightOperand._state));
|
|
|
| /**
|
| - * Return the result of invoking the 'length' getter on this object.
|
| + * Return the result of invoking the 'length' getter on this object. The
|
| + * [typeProvider] is the type provider used to find known types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of invoking the 'length' getter on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl stringLength(TypeProvider typeProvider) =>
|
| new DartObjectImpl(typeProvider.intType, _state.stringLength());
|
|
|
| /**
|
| - * Return the result of invoking the '*' operator on this object with the given argument.
|
| + * Return the result of invoking the '*' operator on this object with the
|
| + * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| + * types.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '*' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| DartObjectImpl times(TypeProvider typeProvider, DartObjectImpl rightOperand) {
|
| InstanceState result = _state.times(rightOperand._state);
|
| @@ -2661,8 +2627,8 @@ class DartObjectImpl implements DartObject {
|
| }
|
|
|
| /**
|
| - * Instances of the class `DeclaredVariables` provide access to the values of variables that
|
| - * have been defined on the command line using the `-D` option.
|
| + * An object used to provide access to the values of variables that have been
|
| + * defined on the command line using the `-D` option.
|
| */
|
| class DeclaredVariables {
|
| /**
|
| @@ -2671,26 +2637,21 @@ class DeclaredVariables {
|
| HashMap<String, String> _declaredVariables = new HashMap<String, String>();
|
|
|
| /**
|
| - * Define a variable with the given name to have the given value.
|
| - *
|
| - * @param variableName the name of the variable being defined
|
| - * @param value the value of the variable
|
| + * Define a variable with the given [name] to have the given [value].
|
| */
|
| - void define(String variableName, String value) {
|
| - _declaredVariables[variableName] = value;
|
| + void define(String name, String value) {
|
| + _declaredVariables[name] = value;
|
| }
|
|
|
| /**
|
| - * Return the value of the variable with the given name interpreted as a boolean value. If the
|
| - * variable is not defined (or [variableName] is null), a DartObject representing "unknown"
|
| - * is returned. If the value can't be parsed as a boolean, a DartObject representing null is
|
| - * returned.
|
| - *
|
| - * @param typeProvider the type provider used to find the type 'bool'
|
| - * @param variableName the name of the variable whose value is to be returned
|
| + * Return the value of the variable with the given [name] interpreted as a
|
| + * 'boolean' value. If the variable is not defined (or [name] is `null`), a
|
| + * DartObject representing "unknown" is returned. If the value cannot be
|
| + * parsed as a boolean, a DartObject representing 'null' is returned. The
|
| + * [typeProvider] is the type provider used to find the type 'bool'.
|
| */
|
| - DartObject getBool(TypeProvider typeProvider, String variableName) {
|
| - String value = _declaredVariables[variableName];
|
| + DartObject getBool(TypeProvider typeProvider, String name) {
|
| + String value = _declaredVariables[name];
|
| if (value == null) {
|
| return new DartObjectImpl(typeProvider.boolType, BoolState.UNKNOWN_VALUE);
|
| }
|
| @@ -2703,16 +2664,13 @@ class DeclaredVariables {
|
| }
|
|
|
| /**
|
| - * Return the value of the variable with the given name interpreted as an integer value. If the
|
| - * variable is not defined (or [variableName] is null), a DartObject representing "unknown"
|
| - * is returned. If the value can't be parsed as an integer, a DartObject representing null is
|
| - * returned.
|
| - *
|
| - * @param typeProvider the type provider used to find the type 'int'
|
| - * @param variableName the name of the variable whose value is to be returned
|
| + * Return the value of the variable with the given [name] interpreted as an
|
| + * integer value. If the variable is not defined (or [name] is `null`), a
|
| + * DartObject representing "unknown" is returned. If the value cannot be
|
| + * parsed as an integer, a DartObject representing 'null' is returned.
|
| */
|
| - DartObject getInt(TypeProvider typeProvider, String variableName) {
|
| - String value = _declaredVariables[variableName];
|
| + DartObject getInt(TypeProvider typeProvider, String name) {
|
| + String value = _declaredVariables[name];
|
| if (value == null) {
|
| return new DartObjectImpl(typeProvider.intType, IntState.UNKNOWN_VALUE);
|
| }
|
| @@ -2726,16 +2684,15 @@ class DeclaredVariables {
|
| }
|
|
|
| /**
|
| - * Return the value of the variable with the given name interpreted as a String value, or
|
| - * `null` if the variable is not defined. Return the value of the variable with the given
|
| - * name interpreted as a String value. If the variable is not defined (or [variableName] is
|
| - * null), a DartObject representing "unknown" is returned.
|
| - *
|
| - * @param typeProvider the type provider used to find the type 'String'
|
| - * @param variableName the name of the variable whose value is to be returned
|
| + * Return the value of the variable with the given [name] interpreted as a
|
| + * String value, or `null` if the variable is not defined. Return the value of
|
| + * the variable with the given name interpreted as a String value. If the
|
| + * variable is not defined (or [name] is `null`), a DartObject representing
|
| + * "unknown" is returned. The [typeProvider] is the type provider used to find
|
| + * the type 'String'.
|
| */
|
| - DartObject getString(TypeProvider typeProvider, String variableName) {
|
| - String value = _declaredVariables[variableName];
|
| + DartObject getString(TypeProvider typeProvider, String name) {
|
| + String value = _declaredVariables[name];
|
| if (value == null) {
|
| return new DartObjectImpl(
|
| typeProvider.stringType, StringState.UNKNOWN_VALUE);
|
| @@ -2745,8 +2702,7 @@ class DeclaredVariables {
|
| }
|
|
|
| /**
|
| - * Instances of the class `DoubleState` represent the state of an object representing a
|
| - * double.
|
| + * The state of an object representing a double.
|
| */
|
| class DoubleState extends NumState {
|
| /**
|
| @@ -2760,9 +2716,8 @@ class DoubleState extends NumState {
|
| final double value;
|
|
|
| /**
|
| - * Initialize a newly created state to represent a double with the given value.
|
| - *
|
| - * @param value the value of this instance
|
| + * Initialize a newly created state to represent a double with the given
|
| + * [value].
|
| */
|
| DoubleState(this.value);
|
|
|
| @@ -3087,8 +3042,8 @@ class DoubleState extends NumState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `DynamicState` represent the state of an object representing a Dart
|
| - * object for which there is no type information.
|
| + * The state of an object representing a Dart object for which there is no type
|
| + * information.
|
| */
|
| class DynamicState extends InstanceState {
|
| /**
|
| @@ -3240,11 +3195,8 @@ class DynamicState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Return an object representing an unknown numeric value whose type is based on the type of the
|
| - * right-hand operand.
|
| - *
|
| - * @param rightOperand the operand whose type will determine the type of the result
|
| - * @return an object representing an unknown numeric value
|
| + * Return an object representing an unknown numeric value whose type is based
|
| + * on the type of the [rightOperand].
|
| */
|
| NumState _unknownNum(InstanceState rightOperand) {
|
| if (rightOperand is IntState) {
|
| @@ -3257,8 +3209,7 @@ class DynamicState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `EvaluationException` represent a run-time exception that would be
|
| - * thrown during the evaluation of Dart code.
|
| + * A run-time exception that would be thrown during the evaluation of Dart code.
|
| */
|
| class EvaluationException extends JavaException {
|
| /**
|
| @@ -3267,16 +3218,13 @@ class EvaluationException extends JavaException {
|
| final ErrorCode errorCode;
|
|
|
| /**
|
| - * Initialize a newly created exception to have the given error code.
|
| - *
|
| - * @param errorCode the error code associated with the exception
|
| + * Initialize a newly created exception to have the given [errorCode].
|
| */
|
| EvaluationException(this.errorCode);
|
| }
|
|
|
| /**
|
| - * Instances of the class `EvaluationResult` represent the result of attempting to evaluate an
|
| - * expression.
|
| + * The result of attempting to evaluate an expression.
|
| */
|
| class EvaluationResult {
|
| /**
|
| @@ -3285,70 +3233,65 @@ class EvaluationResult {
|
| final DartObject value;
|
|
|
| /**
|
| - * The errors that should be reported for the expression(s) that were evaluated.
|
| + * The errors that should be reported for the expression(s) that were
|
| + * evaluated.
|
| */
|
| final List<AnalysisError> _errors;
|
|
|
| /**
|
| - * Initialize a newly created result object with the given state. Clients should use one of the
|
| - * factory methods: [forErrors] and [forValue].
|
| - *
|
| - * @param value the value of the expression
|
| - * @param errors the errors that should be reported for the expression(s) that were evaluated
|
| + * Initialize a newly created result object with the given [value] and set of
|
| + * [_errors]. Clients should use one of the factory methods: [forErrors] and
|
| + * [forValue].
|
| */
|
| EvaluationResult(this.value, this._errors);
|
|
|
| /**
|
| - * Return an array containing the errors that should be reported for the expression(s) that were
|
| - * evaluated. If there are no such errors, the array will be empty. The array can be empty even if
|
| - * the expression is not a valid compile time constant if the errors would have been reported by
|
| - * other parts of the analysis engine.
|
| + * Return a list containing the errors that should be reported for the
|
| + * expression(s) that were evaluated. If there are no such errors, the list
|
| + * will be empty. The list can be empty even if the expression is not a valid
|
| + * compile time constant if the errors would have been reported by other parts
|
| + * of the analysis engine.
|
| */
|
| List<AnalysisError> get errors =>
|
| _errors == null ? AnalysisError.NO_ERRORS : _errors;
|
|
|
| /**
|
| - * Return `true` if the expression is a compile-time constant expression that would not
|
| - * throw an exception when evaluated.
|
| - *
|
| - * @return `true` if the expression is a valid compile-time constant expression
|
| + * Return `true` if the expression is a compile-time constant expression that
|
| + * would not throw an exception when evaluated.
|
| */
|
| bool get isValid => _errors == null;
|
|
|
| /**
|
| - * Return an evaluation result representing the result of evaluating an expression that is not a
|
| - * compile-time constant because of the given errors.
|
| - *
|
| - * @param errors the errors that should be reported for the expression(s) that were evaluated
|
| - * @return the result of evaluating an expression that is not a compile-time constant
|
| + * Return an evaluation result representing the result of evaluating an
|
| + * expression that is not a compile-time constant because of the given
|
| + * [errors].
|
| */
|
| static EvaluationResult forErrors(List<AnalysisError> errors) =>
|
| new EvaluationResult(null, errors);
|
|
|
| /**
|
| - * Return an evaluation result representing the result of evaluating an expression that is a
|
| - * compile-time constant that evaluates to the given value.
|
| - *
|
| - * @param value the value of the expression
|
| - * @return the result of evaluating an expression that is a compile-time constant
|
| + * Return an evaluation result representing the result of evaluating an
|
| + * expression that is a compile-time constant that evaluates to the given
|
| + * [value].
|
| */
|
| static EvaluationResult forValue(DartObject value) =>
|
| new EvaluationResult(value, null);
|
| }
|
|
|
| /**
|
| - * Instances of the class `InternalResult` represent the result of attempting to evaluate a
|
| - * expression.
|
| + * The result of attempting to evaluate a expression.
|
| */
|
| class EvaluationResultImpl {
|
| /**
|
| - * The errors encountered while trying to evaluate the compile time constant. These errors may or
|
| - * may not have prevented the expression from being a valid compile time constant.
|
| + * The errors encountered while trying to evaluate the compile time constant.
|
| + * These errors may or may not have prevented the expression from being a
|
| + * valid compile time constant.
|
| */
|
| List<AnalysisError> _errors;
|
|
|
| /**
|
| - * The value of the expression, or null if the value couldn't be computed due to errors.
|
| + * The value of the expression, or `null` if the value couldn't be computed
|
| + * due to errors.
|
| */
|
| final DartObjectImpl value;
|
|
|
| @@ -3383,8 +3326,7 @@ class EvaluationResultImpl {
|
| }
|
|
|
| /**
|
| - * Instances of the class `FunctionState` represent the state of an object representing a
|
| - * function.
|
| + * The state of an object representing a function.
|
| */
|
| class FunctionState extends InstanceState {
|
| /**
|
| @@ -3393,9 +3335,8 @@ class FunctionState extends InstanceState {
|
| final ExecutableElement _element;
|
|
|
| /**
|
| - * Initialize a newly created state to represent the given function.
|
| - *
|
| - * @param element the element representing the function being modeled
|
| + * Initialize a newly created state to represent the function with the given
|
| + * [element].
|
| */
|
| FunctionState(this._element);
|
|
|
| @@ -3444,8 +3385,8 @@ class FunctionState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `GenericState` represent the state of an object representing a Dart
|
| - * object for which there is no more specific state.
|
| + * The state of an object representing a Dart object for which there is no more
|
| + * specific state.
|
| */
|
| class GenericState extends InstanceState {
|
| /**
|
| @@ -3465,9 +3406,8 @@ class GenericState extends InstanceState {
|
| final HashMap<String, DartObjectImpl> _fieldMap;
|
|
|
| /**
|
| - * Initialize a newly created state to represent a newly created object.
|
| - *
|
| - * @param fieldMap the values of the fields of this instance
|
| + * Initialize a newly created state to represent a newly created object. The
|
| + * [fieldMap] contains the values of the fields of the instance.
|
| */
|
| GenericState(this._fieldMap);
|
|
|
| @@ -3549,65 +3489,54 @@ class GenericState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * The class `InstanceState` defines the behavior of objects representing the state of a Dart
|
| - * object.
|
| + * The state of an object representing a Dart object.
|
| */
|
| abstract class InstanceState {
|
| /**
|
| - * If this represents a generic dart object, return a map from its fieldnames to their values.
|
| - * Otherwise return null.
|
| + * If this represents a generic dart object, return a map from its field names
|
| + * to their values. Otherwise return null.
|
| */
|
| HashMap<String, DartObjectImpl> get fields => null;
|
|
|
| /**
|
| * Return `true` if this object's value can be represented exactly.
|
| - *
|
| - * @return `true` if this object's value can be represented exactly
|
| */
|
| bool get hasExactValue => false;
|
|
|
| /**
|
| * Return `true` if this object represents an object whose type is 'bool'.
|
| - *
|
| - * @return `true` if this object represents a boolean value
|
| */
|
| bool get isBool => false;
|
|
|
| /**
|
| - * Return `true` if this object represents an object whose type is either 'bool', 'num',
|
| - * 'String', or 'Null'.
|
| - *
|
| - * @return `true` if this object represents either a boolean, numeric, string or null value
|
| + * Return `true` if this object represents an object whose type is either
|
| + * 'bool', 'num', 'String', or 'Null'.
|
| */
|
| bool get isBoolNumStringOrNull => false;
|
|
|
| /**
|
| - * Return true if this object represents an unknown value.
|
| + * Return `true` if this object represents an unknown value.
|
| */
|
| bool get isUnknown => false;
|
|
|
| /**
|
| * Return the name of the type of this value.
|
| - *
|
| - * @return the name of the type of this value
|
| */
|
| String get typeName;
|
|
|
| /**
|
| - * Return this object's value if it can be represented exactly, or `null` if either the
|
| - * value cannot be represented exactly or if the value is `null`. Clients should use
|
| - * [hasExactValue] to distinguish between these two cases.
|
| - *
|
| - * @return this object's value
|
| + * Return this object's value if it can be represented exactly, or `null` if
|
| + * either the value cannot be represented exactly or if the value is `null`.
|
| + * Clients should use [hasExactValue] to distinguish between these two cases.
|
| */
|
| Object get value => null;
|
|
|
| /**
|
| - * Return the result of invoking the '+' operator on this object with the given argument.
|
| + * Return the result of invoking the '+' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '+' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| InstanceState add(InstanceState rightOperand) {
|
| if (this is StringState && rightOperand is StringState) {
|
| @@ -3619,10 +3548,7 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Throw an exception if the given state does not represent a boolean value.
|
| - *
|
| - * @param state the state being tested
|
| - * @throws EvaluationException if the given state does not represent a boolean value
|
| + * Throw an exception if the given [state] does not represent a boolean value.
|
| */
|
| void assertBool(InstanceState state) {
|
| if (!(state is BoolState || state is DynamicState)) {
|
| @@ -3631,12 +3557,8 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Throw an exception if the given state does not represent a boolean, numeric, string or null
|
| - * value.
|
| - *
|
| - * @param state the state being tested
|
| - * @throws EvaluationException if the given state does not represent a boolean, numeric, string or
|
| - * null value
|
| + * Throw an exception if the given [state] does not represent a boolean,
|
| + * numeric, string or null value.
|
| */
|
| void assertBoolNumStringOrNull(InstanceState state) {
|
| if (!(state is BoolState ||
|
| @@ -3652,10 +3574,8 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Throw an exception if the given state does not represent an integer or null value.
|
| - *
|
| - * @param state the state being tested
|
| - * @throws EvaluationException if the given state does not represent an integer or null value
|
| + * Throw an exception if the given [state] does not represent an integer or
|
| + * null value.
|
| */
|
| void assertIntOrNull(InstanceState state) {
|
| if (!(state is IntState ||
|
| @@ -3667,12 +3587,8 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Throw an exception if the given state does not represent a boolean, numeric, string or null
|
| - * value.
|
| - *
|
| - * @param state the state being tested
|
| - * @throws EvaluationException if the given state does not represent a boolean, numeric, string or
|
| - * null value
|
| + * Throw an exception if the given [state] does not represent a boolean,
|
| + * numeric, string or null value.
|
| */
|
| void assertNumOrNull(InstanceState state) {
|
| if (!(state is DoubleState ||
|
| @@ -3685,10 +3601,7 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Throw an exception if the given state does not represent a String value.
|
| - *
|
| - * @param state the state being tested
|
| - * @throws EvaluationException if the given state does not represent a String value
|
| + * Throw an exception if the given [state] does not represent a String value.
|
| */
|
| void assertString(InstanceState state) {
|
| if (!(state is StringState || state is DynamicState)) {
|
| @@ -3697,11 +3610,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '&' operator on this object with the given argument.
|
| + * Return the result of invoking the '&' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '&' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState bitAnd(InstanceState rightOperand) {
|
| assertIntOrNull(this);
|
| @@ -3712,8 +3625,8 @@ abstract class InstanceState {
|
| /**
|
| * Return the result of invoking the '~' operator on this object.
|
| *
|
| - * @return the result of invoking the '~' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState bitNot() {
|
| assertIntOrNull(this);
|
| @@ -3721,11 +3634,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '|' operator on this object with the given argument.
|
| + * Return the result of invoking the '|' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '|' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState bitOr(InstanceState rightOperand) {
|
| assertIntOrNull(this);
|
| @@ -3734,11 +3647,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '^' operator on this object with the given argument.
|
| + * Return the result of invoking the '^' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '^' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState bitXor(InstanceState rightOperand) {
|
| assertIntOrNull(this);
|
| @@ -3747,11 +3660,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the ' ' operator on this object with the given argument.
|
| + * Return the result of invoking the ' ' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the ' ' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| StringState concatenate(InstanceState rightOperand) {
|
| assertString(rightOperand);
|
| @@ -3761,26 +3674,25 @@ abstract class InstanceState {
|
| /**
|
| * Return the result of applying boolean conversion to this object.
|
| *
|
| - * @param typeProvider the type provider used to find known types
|
| - * @return the result of applying boolean conversion to this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState convertToBool() => BoolState.FALSE_STATE;
|
|
|
| /**
|
| * Return the result of converting this object to a String.
|
| *
|
| - * @return the result of converting this object to a String
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| StringState convertToString();
|
|
|
| /**
|
| - * Return the result of invoking the '/' operator on this object with the given argument.
|
| + * Return the result of invoking the '/' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '/' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| NumState divide(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3789,20 +3701,20 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '==' operator on this object with the given argument.
|
| + * Return the result of invoking the '==' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '==' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState equalEqual(InstanceState rightOperand);
|
|
|
| /**
|
| - * Return the result of invoking the '>' operator on this object with the given argument.
|
| + * Return the result of invoking the '>' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState greaterThan(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3811,11 +3723,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '>=' operator on this object with the given argument.
|
| + * Return the result of invoking the '>=' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>=' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState greaterThanOrEqual(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3824,11 +3736,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '~/' operator on this object with the given argument.
|
| + * Return the result of invoking the '~/' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '~/' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState integerDivide(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3838,20 +3750,16 @@ abstract class InstanceState {
|
|
|
| /**
|
| * Return the result of invoking the identical function on this object with
|
| - * the given argument.
|
| - *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the identical function on this object with
|
| - * the given argument
|
| + * the [rightOperand].
|
| */
|
| BoolState isIdentical(InstanceState rightOperand);
|
|
|
| /**
|
| - * Return the result of invoking the '<' operator on this object with the given argument.
|
| + * Return the result of invoking the '<' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState lessThan(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3860,11 +3768,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '<=' operator on this object with the given argument.
|
| + * Return the result of invoking the '<=' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<=' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState lessThanOrEqual(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3873,11 +3781,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '&&' operator on this object with the given argument.
|
| + * Return the result of invoking the '&&' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '&&' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState logicalAnd(InstanceState rightOperand) {
|
| assertBool(this);
|
| @@ -3888,8 +3796,8 @@ abstract class InstanceState {
|
| /**
|
| * Return the result of invoking the '!' operator on this object.
|
| *
|
| - * @return the result of invoking the '!' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState logicalNot() {
|
| assertBool(this);
|
| @@ -3897,11 +3805,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '||' operator on this object with the given argument.
|
| + * Return the result of invoking the '||' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '||' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| BoolState logicalOr(InstanceState rightOperand) {
|
| assertBool(this);
|
| @@ -3910,11 +3818,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '-' operator on this object with the given argument.
|
| + * Return the result of invoking the '-' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '-' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| NumState minus(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3925,8 +3833,8 @@ abstract class InstanceState {
|
| /**
|
| * Return the result of invoking the '-' operator on this object.
|
| *
|
| - * @return the result of invoking the '-' operator on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| NumState negated() {
|
| assertNumOrNull(this);
|
| @@ -3934,11 +3842,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '%' operator on this object with the given argument.
|
| + * Return the result of invoking the '%' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '%' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| NumState remainder(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3947,11 +3855,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '<<' operator on this object with the given argument.
|
| + * Return the result of invoking the '<<' operator on this object with
|
| + * the [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '<<' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState shiftLeft(InstanceState rightOperand) {
|
| assertIntOrNull(this);
|
| @@ -3960,11 +3868,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '>>' operator on this object with the given argument.
|
| + * Return the result of invoking the '>>' operator on this object with
|
| + * the [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '>>' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState shiftRight(InstanceState rightOperand) {
|
| assertIntOrNull(this);
|
| @@ -3975,8 +3883,8 @@ abstract class InstanceState {
|
| /**
|
| * Return the result of invoking the 'length' getter on this object.
|
| *
|
| - * @return the result of invoking the 'length' getter on this object
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| IntState stringLength() {
|
| assertString(this);
|
| @@ -3984,11 +3892,11 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Return the result of invoking the '*' operator on this object with the given argument.
|
| + * Return the result of invoking the '*' operator on this object with the
|
| + * [rightOperand].
|
| *
|
| - * @param rightOperand the right-hand operand of the operation
|
| - * @return the result of invoking the '*' operator on this object with the given argument
|
| - * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + * Throws an [EvaluationException] if the operator is not appropriate for an
|
| + * object of this kind.
|
| */
|
| NumState times(InstanceState rightOperand) {
|
| assertNumOrNull(this);
|
| @@ -3998,7 +3906,7 @@ abstract class InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `IntState` represent the state of an object representing an int.
|
| + * The state of an object representing an int.
|
| */
|
| class IntState extends NumState {
|
| /**
|
| @@ -4012,9 +3920,8 @@ class IntState extends NumState {
|
| final int value;
|
|
|
| /**
|
| - * Initialize a newly created state to represent an int with the given value.
|
| - *
|
| - * @param value the value of this instance
|
| + * Initialize a newly created state to represent an int with the given
|
| + * [value].
|
| */
|
| IntState(this.value);
|
|
|
| @@ -4467,8 +4374,7 @@ class IntState extends NumState {
|
| }
|
|
|
| /**
|
| - * The unique instance of the class `ListState` represents the state of an object representing
|
| - * a list.
|
| + * The state of an object representing a list.
|
| */
|
| class ListState extends InstanceState {
|
| /**
|
| @@ -4477,9 +4383,8 @@ class ListState extends InstanceState {
|
| final List<DartObjectImpl> _elements;
|
|
|
| /**
|
| - * Initialize a newly created state to represent a list with the given elements.
|
| - *
|
| - * @param elements the elements of the list
|
| + * Initialize a newly created state to represent a list with the given
|
| + * [elements].
|
| */
|
| ListState(this._elements);
|
|
|
| @@ -4577,8 +4482,7 @@ class ListState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * The unique instance of the class `ListState` represents the state of an object representing
|
| - * a map.
|
| + * The state of an object representing a map.
|
| */
|
| class MapState extends InstanceState {
|
| /**
|
| @@ -4587,9 +4491,8 @@ class MapState extends InstanceState {
|
| final HashMap<DartObjectImpl, DartObjectImpl> _entries;
|
|
|
| /**
|
| - * Initialize a newly created state to represent a map with the given entries.
|
| - *
|
| - * @param entries the entries in the map
|
| + * Initialize a newly created state to represent a map with the given
|
| + * [entries].
|
| */
|
| MapState(this._entries);
|
|
|
| @@ -4689,11 +4592,11 @@ class MapState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * The unique instance of the class `NullState` represents the state of the value 'null'.
|
| + * The state of an object representing the value 'null'.
|
| */
|
| class NullState extends InstanceState {
|
| /**
|
| - * An instance representing the boolean value 'true'.
|
| + * An instance representing the boolean value 'null'.
|
| */
|
| static NullState NULL_STATE = new NullState();
|
|
|
| @@ -4746,8 +4649,7 @@ class NullState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `NumState` represent the state of an object representing a number of
|
| - * an unknown type (a 'num').
|
| + * The state of an object representing a number of an unknown type (a 'num').
|
| */
|
| class NumState extends InstanceState {
|
| /**
|
| @@ -4863,8 +4765,8 @@ class NumState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `ReferenceFinder` add reference information for a given variable to
|
| - * the bi-directional mapping used to order the evaluation of constants.
|
| + * An object used to add reference information for a given variable to the
|
| + * bi-directional mapping used to order the evaluation of constants.
|
| */
|
| class ReferenceFinder extends RecursiveAstVisitor<Object> {
|
| /**
|
| @@ -4873,8 +4775,9 @@ class ReferenceFinder extends RecursiveAstVisitor<Object> {
|
| final AstNode _source;
|
|
|
| /**
|
| - * A graph in which the nodes are the constant variables and the edges are from each variable to
|
| - * the other constant variables that are referenced in the head's initializer.
|
| + * A graph in which the nodes are the constant variables and the edges are
|
| + * from each variable to the other constant variables that are referenced in
|
| + * the head's initializer.
|
| */
|
| final DirectedGraph<AstNode> _referenceGraph;
|
|
|
| @@ -4884,21 +4787,20 @@ class ReferenceFinder extends RecursiveAstVisitor<Object> {
|
| final HashMap<VariableElement, VariableDeclaration> _variableDeclarationMap;
|
|
|
| /**
|
| - * A table mapping constant constructors to the declarations of those constructors.
|
| + * A table mapping constant constructors to the declarations of those
|
| + * constructors.
|
| */
|
| final HashMap<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap;
|
|
|
| /**
|
| - * Initialize a newly created reference finder to find references from the given variable to other
|
| - * variables and to add those references to the given graph.
|
| - *
|
| - * @param source the element representing the variable whose initializer will be visited
|
| - * @param referenceGraph a graph recording which variables (heads) reference which other variables
|
| - * (tails) in their initializers
|
| - * @param variableDeclarationMap A table mapping constant variables to the declarations of those
|
| - * variables.
|
| - * @param constructorDeclarationMap A table mapping constant constructors to the declarations of
|
| - * those constructors.
|
| + * Initialize a newly created reference finder to find references from a given
|
| + * variable to other variables and to add those references to the given graph.
|
| + * The [source] is the element representing the variable whose initializer
|
| + * will be visited. The [referenceGraph] is a graph recording which variables
|
| + * (heads) reference which other variables (tails) in their initializers. The
|
| + * [variableDeclarationMap] is a table mapping constant variables to the
|
| + * declarations of those variables. The [constructorDeclarationMap] is a table
|
| + * mapping constant constructors to the declarations of those constructors.
|
| */
|
| ReferenceFinder(this._source, this._referenceGraph,
|
| this._variableDeclarationMap, this._constructorDeclarationMap);
|
| @@ -4970,8 +4872,7 @@ class ReferenceFinder extends RecursiveAstVisitor<Object> {
|
| }
|
|
|
| /**
|
| - * Instances of the class `StringState` represent the state of an object representing a
|
| - * string.
|
| + * The state of an object representing a string.
|
| */
|
| class StringState extends InstanceState {
|
| /**
|
| @@ -4985,9 +4886,7 @@ class StringState extends InstanceState {
|
| final String value;
|
|
|
| /**
|
| - * Initialize a newly created state to represent the given value.
|
| - *
|
| - * @param value the value of this instance
|
| + * Initialize a newly created state to represent the given [value].
|
| */
|
| StringState(this.value);
|
|
|
| @@ -5066,8 +4965,7 @@ class StringState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `StringState` represent the state of an object representing a
|
| - * symbol.
|
| + * The state of an object representing a symbol.
|
| */
|
| class SymbolState extends InstanceState {
|
| /**
|
| @@ -5076,9 +4974,7 @@ class SymbolState extends InstanceState {
|
| final String value;
|
|
|
| /**
|
| - * Initialize a newly created state to represent the given value.
|
| - *
|
| - * @param value the value of this instance
|
| + * Initialize a newly created state to represent the given [value].
|
| */
|
| SymbolState(this.value);
|
|
|
| @@ -5131,7 +5027,7 @@ class SymbolState extends InstanceState {
|
| }
|
|
|
| /**
|
| - * Instances of the class `TypeState` represent the state of an object representing a type.
|
| + * The state of an object representing a type.
|
| */
|
| class TypeState extends InstanceState {
|
| /**
|
| @@ -5140,9 +5036,7 @@ class TypeState extends InstanceState {
|
| final Element _element;
|
|
|
| /**
|
| - * Initialize a newly created state to represent the given value.
|
| - *
|
| - * @param element the element representing the type being modeled
|
| + * Initialize a newly created state to represent the given [value].
|
| */
|
| TypeState(this._element);
|
|
|
|
|