Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1021083002: Clean up comments in error verifier (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 0cc8e6d35f455d6e177ee3ae14ee2d4e8eea95ef..9bc9e3759618232ffc7b9e875a7b329eb8e72eef 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -22,14 +22,14 @@ import 'sdk.dart' show DartSdk, SdkLibrary;
import 'utilities_dart.dart';
/**
- * Instances of the class `ErrorVerifier` traverse an AST structure looking for additional
- * errors and warnings not covered by the parser and resolver.
+ * A visitor used to traverse an AST structure looking for additional errors and
+ * warnings not covered by the parser and resolver.
*/
class ErrorVerifier extends RecursiveAstVisitor<Object> {
/**
* Static final string with value `"getter "` used in the construction of the
- * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and similar, error
- * code messages.
+ * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and
+ * similar, error code messages.
*
* See [_checkForNonAbstractClassInheritsAbstractMember].
*/
@@ -37,8 +37,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
/**
* Static final string with value `"setter "` used in the construction of the
- * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and similar, error
- * code messages.
+ * [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE], and
+ * similar, error code messages.
*
* See [_checkForNonAbstractClassInheritsAbstractMember].
*/
@@ -75,158 +75,164 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
final InheritanceManager _inheritanceManager;
/**
- * This is set to `true` iff the visitor is currently visiting children nodes of a
- * [ConstructorDeclaration] and the constructor is 'const'.
+ * A flag indicating whether the visitor is currently within a constructor
+ * declaration that is 'const'.
*
* See [visitConstructorDeclaration].
*/
bool _isEnclosingConstructorConst = false;
/**
- * A flag indicating whether we are currently within a function body marked as being asynchronous.
+ * A flag indicating whether we are currently within a function body marked as
+ * being asynchronous.
*/
bool _inAsync = false;
/**
- * A flag indicating whether we are currently within a function body marked as being a generator.
+ * A flag indicating whether we are currently within a function body marked a
+ * being a generator.
*/
bool _inGenerator = false;
/**
- * This is set to `true` iff the visitor is currently visiting children nodes of a
- * [CatchClause].
+ * A flag indicating whether the visitor is currently within a catch clause.
*
* See [visitCatchClause].
*/
bool _isInCatchClause = false;
/**
- * This is set to `true` iff the visitor is currently visiting children nodes of an
- * [Comment].
+ * A flag indicating whether the visitor is currently within a comment.
*/
bool _isInComment = false;
/**
- * This is set to `true` iff the visitor is currently visiting children nodes of an
- * [InstanceCreationExpression].
+ * A flag indicating whether the visitor is currently within an instance
+ * creation expression.
*/
bool _isInConstInstanceCreation = false;
/**
- * This is set to `true` iff the visitor is currently visiting children nodes of a native
- * [ClassDeclaration].
+ * A flag indicating whether the visitor is currently within a native class
+ * declaration.
*/
bool _isInNativeClass = false;
/**
- * This is set to `true` iff the visitor is currently visiting a static variable
+ * A flag indicating whether the visitor is currently within a static variable
* declaration.
*/
bool _isInStaticVariableDeclaration = false;
/**
- * This is set to `true` iff the visitor is currently visiting an instance variable
- * declaration.
+ * A flag indicating whether the visitor is currently within an instance
+ * variable declaration.
*/
bool _isInInstanceVariableDeclaration = false;
/**
- * This is set to `true` iff the visitor is currently visiting an instance variable
- * initializer.
+ * A flag indicating whether the visitor is currently within an instance
+ * variable initializer.
*/
bool _isInInstanceVariableInitializer = false;
/**
- * This is set to `true` iff the visitor is currently visiting a
- * [ConstructorInitializer].
+ * A flag indicating whether the visitor is currently within a constructor
+ * initializer.
*/
bool _isInConstructorInitializer = false;
/**
- * This is set to `true` iff the visitor is currently visiting a
- * [FunctionTypedFormalParameter].
+ * This is set to `true` iff the visitor is currently within a function typed
+ * formal parameter.
*/
bool _isInFunctionTypedFormalParameter = false;
/**
- * This is set to `true` iff the visitor is currently visiting a static method. By "method"
- * here getter, setter and operator declarations are also implied since they are all represented
- * with a [MethodDeclaration] in the AST structure.
+ * A flag indicating whether the visitor is currently within a static method.
+ * By "method" here getter, setter and operator declarations are also implied
+ * since they are all represented with a [MethodDeclaration] in the AST
+ * structure.
*/
bool _isInStaticMethod = false;
/**
- * This is set to `true` iff the visitor is currently visiting a factory constructor.
+ * A flag indicating whether the visitor is currently within a factory
+ * constructor.
*/
bool _isInFactory = false;
/**
- * This is set to `true` iff the visitor is currently visiting code in the SDK.
+ * A flag indicating whether the visitor is currently within code in the SDK.
*/
bool _isInSystemLibrary = false;
/**
- * A flag indicating whether the current library contains at least one import directive with a URI
- * that uses the "dart-ext" scheme.
+ * A flag indicating whether the current library contains at least one import
+ * directive with a URI that uses the "dart-ext" scheme.
*/
bool _hasExtUri = false;
/**
- * This is set to `false` on the entry of every [BlockFunctionBody], and is restored
- * to the enclosing value on exit. The value is used in
- * [checkForMixedReturns] to prevent both
- * [StaticWarningCode.MIXED_RETURN_TYPES] and [StaticWarningCode.RETURN_WITHOUT_VALUE]
- * from being generated in the same function body.
+ * This is set to `false` on the entry of every [BlockFunctionBody], and is
+ * restored to the enclosing value on exit. The value is used in
+ * [_checkForMixedReturns] to prevent both
+ * [StaticWarningCode.MIXED_RETURN_TYPES] and
+ * [StaticWarningCode.RETURN_WITHOUT_VALUE] from being generated in the same
+ * function body.
*/
bool _hasReturnWithoutValue = false;
/**
- * The class containing the AST nodes being visited, or `null` if we are not in the scope of
- * a class.
+ * The class containing the AST nodes being visited, or `null` if we are not
+ * in the scope of a class.
*/
ClassElement _enclosingClass;
/**
- * The method or function that we are currently visiting, or `null` if we are not inside a
- * method or function.
+ * The method or function that we are currently visiting, or `null` if we are
+ * not inside a method or function.
*/
ExecutableElement _enclosingFunction;
/**
- * The return statements found in the method or function that we are currently visiting that have
- * a return value.
+ * The return statements found in the method or function that we are currently
+ * visiting that have a return value.
*/
List<ReturnStatement> _returnsWith = new List<ReturnStatement>();
/**
- * The return statements found in the method or function that we are currently visiting that do
- * not have a return value.
+ * The return statements found in the method or function that we are currently
+ * visiting that do not have a return value.
*/
List<ReturnStatement> _returnsWithout = new List<ReturnStatement>();
/**
- * This map is initialized when visiting the contents of a class declaration. If the visitor is
- * not in an enclosing class declaration, then the map is set to `null`.
+ * This map is initialized when visiting the contents of a class declaration.
+ * If the visitor is not in an enclosing class declaration, then the map is
+ * set to `null`.
*
* When set the map maps the set of [FieldElement]s in the class to an
- * [INIT_STATE.NOT_INIT] or [INIT_STATE.INIT_IN_DECLARATION]. <code>checkFor*</code>
- * methods, specifically [checkForAllFinalInitializedErrorCodes],
- * can make a copy of the map to compute error code states. <code>checkFor*</code> methods should
- * only ever make a copy, or read from this map after it has been set in
- * [visitClassDeclaration].
+ * [INIT_STATE.NOT_INIT] or [INIT_STATE.INIT_IN_DECLARATION]. The `checkFor*`
+ * methods, specifically [_checkForAllFinalInitializedErrorCodes], can make a
+ * copy of the map to compute error code states. The `checkFor*` methods
+ * should only ever make a copy, or read from this map after it has been set
+ * in [visitClassDeclaration].
*
* See [visitClassDeclaration], and [_checkForAllFinalInitializedErrorCodes].
*/
HashMap<FieldElement, INIT_STATE> _initialFieldElementsMap;
/**
- * A table mapping name of the library to the export directive which export this library.
+ * A table mapping name of the library to the export directive which export
+ * this library.
*/
HashMap<String, LibraryElement> _nameToExportElement =
new HashMap<String, LibraryElement>();
/**
- * A table mapping name of the library to the import directive which import this library.
+ * A table mapping name of the library to the import directive which import
+ * this library.
*/
HashMap<String, LibraryElement> _nameToImportElement =
new HashMap<String, LibraryElement>();
@@ -243,13 +249,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
new HashSet<String>();
/**
- * A list of types used by the [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS] and
- * [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS] error codes.
+ * A list of types used by the [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]
+ * and [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS] error codes.
*/
List<InterfaceType> _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT;
/**
- * Initialize the [ErrorVerifier] visitor.
+ * Initialize a newly created error verifier.
*/
ErrorVerifier(this._errorReporter, this._currentLibrary, this._typeProvider,
this._inheritanceManager) {
@@ -440,7 +446,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
* Implementation of this method should be synchronized with
* [visitClassDeclaration].
*/
- visitClassDeclarationIncrementally(ClassDeclaration node) {
+ void visitClassDeclarationIncrementally(ClassDeclaration node) {
_isInNativeClass = node.nativeClause != null;
_enclosingClass = node.element;
// initialize initialFieldElementsMap
@@ -1091,10 +1097,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies if the passed map literal has type arguments then there is exactly two.
+ * Verify that the given list of [typeArguments] contains exactly two
+ * elements.
*
- * @param typeArguments the type arguments, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS].
*/
bool _checkExpectedTwoMapTypeArguments(TypeArgumentList typeArguments) {
@@ -1111,14 +1116,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed constructor declaration does not violate any of the error codes
- * relating to the initialization of fields in the enclosing class.
+ * Verify that the given [constructor] declaration does not violate any of the
+ * error codes relating to the initialization of fields in the enclosing
+ * class.
*
- * @param node the [ConstructorDeclaration] to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [_initialFieldElementsMap],
- * [StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR],
- * and [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES].
+ * [StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR], and
+ * [CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES].
*/
bool _checkForAllFinalInitializedErrorCodes(ConstructorDeclaration node) {
if (node.factoryKeyword != null ||
@@ -1252,13 +1256,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the passed executable element against override-error codes.
+ * Check the given [executableElement] against override-error codes. The
+ * [overriddenExecutable] is the element that the executable element is
+ * overriding. The [parameters] is the parameters of the executable element.
+ * The [errorNameTarget] is the node to report problems on.
*
- * @param executableElement a non-null [ExecutableElement] to evaluate
- * @param overriddenExecutable the element that the executableElement is overriding
- * @param parameters the parameters of the executable element
- * @param errorNameTarget the node to report problems on
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC],
* [CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED],
* [CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL],
@@ -1417,9 +1419,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
// SWC.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES
//
- // Create three arrays: an array of the optional parameter ASTs
- // (FormalParameters), an array of the optional parameters elements from our
- // method, and finally an array of the optional parameter elements from the
+ // Create three lists: a list of the optional parameter ASTs
+ // (FormalParameters), a list of the optional parameters elements from our
+ // method, and finally a list of the optional parameter elements from the
// method we are overriding.
//
bool foundError = false;
@@ -1527,16 +1529,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the passed executable element against override-error codes. This method computes
- * the passed executableElement is overriding and calls
- * [checkForAllInvalidOverrideErrorCodes]
- * when the [InheritanceManager] returns a [MultiplyInheritedExecutableElement], this
- * method loops through the array in the [MultiplyInheritedExecutableElement].
- *
- * @param executableElement a non-null [ExecutableElement] to evaluate
- * @param parameters the parameters of the executable element
- * @param errorNameTarget the node to report problems on
- * @return `true` if and only if an error code is generated on the passed node
+ * Check the given [executableElement] against override-error codes. This
+ * method computes the given executableElement is overriding and calls
+ * [_checkForAllInvalidOverrideErrorCodes] when the [InheritanceManager]
+ * returns a [MultiplyInheritedExecutableElement], this method loops through
+ * the list in the [MultiplyInheritedExecutableElement]. The [parameters] are
+ * the parameters of the executable element. The [errorNameTarget] is the node
+ * to report problems on.
*/
bool _checkForAllInvalidOverrideErrorCodesForExecutable(
ExecutableElement executableElement, List<ParameterElement> parameters,
@@ -1560,10 +1559,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the passed field declaration against override-error codes.
+ * Check the given [field] declaration against override-error codes.
*
- * @param node the [MethodDeclaration] to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [_checkForAllInvalidOverrideErrorCodes].
*/
bool _checkForAllInvalidOverrideErrorCodesForField(FieldDeclaration node) {
@@ -1597,10 +1594,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the passed method declaration against override-error codes.
+ * Check the given [method] declaration against override-error codes.
*
- * @param node the [MethodDeclaration] to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [_checkForAllInvalidOverrideErrorCodes].
*/
bool _checkForAllInvalidOverrideErrorCodesForMethod(MethodDeclaration node) {
@@ -1627,10 +1622,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that all classes of the passed 'with' clause are valid.
+ * Verify that all classes of the given [withClause] are valid.
*
- * @param node the 'with' clause to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR],
* [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT], and
* [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER].
@@ -1669,10 +1662,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks error related to the redirected constructors.
+ * Check for errors related to the redirected constructors.
*
- * @param node the constructor declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE],
* [StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE], and
* [StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR].
@@ -1743,18 +1734,16 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that the return statement of the form <i>return e;</i> is not in a generative
- * constructor.
+ * Check that the return [statement] of the form <i>return e;</i> is not in a
+ * generative constructor.
*
- * This checks that return statements without expressions are not in a generative constructor and
- * the return type is not assignable to `null`; that is, we don't have `return;` if
- * the enclosing method has a return type.
+ * Check that return statements without expressions are not in a generative
+ * constructor and the return type is not assignable to `null`; that is, we
+ * don't have `return;` if the enclosing method has a return type.
*
- * This checks that the return type matches the type of the declared return type in the enclosing
- * method or function.
+ * Check that the return type matches the type of the declared return type in
+ * the enclosing method or function.
*
- * @param node the return statement to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR],
* [StaticWarningCode.RETURN_WITHOUT_VALUE], and
* [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE].
@@ -1799,14 +1788,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the export namespace of the passed export directive does not export any name
- * already exported by other export directive.
+ * Verify that the export namespace of the given export [directive] does not
+ * export any name already exported by another export directive. The
+ * [exportElement] is the [ExportElement] retrieved from the node. If the
+ * element in the node was `null`, then this method is not called. The
+ * [exportedLibrary] is the library element containing the exported element.
*
- * @param node the export directive node to report problem on
- * @param exportElement the [ExportElement] retrieved from the node, if the element in the
- * node was `null`, then this method is not called
- * @param exportedLibrary the library element containing the exported element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.AMBIGUOUS_EXPORT].
*/
bool _checkForAmbiguousExport(ExportDirective node,
@@ -1837,17 +1824,16 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed expression can be assigned to its corresponding parameters.
+ * Verify that the given [expression] can be assigned to its corresponding
+ * parameters. The [expectedStaticType] is the expected static type of the
+ * parameter. The [actualStaticType] is the actual static type of the
+ * argument. The [expectedPropagatedType] is the expected propagated type of
+ * the parameter, may be `null`. The [actualPropagatedType] is the expected
+ * propagated type of the parameter, may be `null`.
*
- * This method corresponds to BestPracticesVerifier.checkForArgumentTypeNotAssignable.
+ * This method corresponds to
+ * [BestPracticesVerifier.checkForArgumentTypeNotAssignable].
*
- * @param expression the expression to evaluate
- * @param expectedStaticType the expected static type of the parameter
- * @param actualStaticType the actual static type of the argument
- * @param expectedPropagatedType the expected propagated type of the parameter, may be
- * `null`
- * @param actualPropagatedType the expected propagated type of the parameter, may be `null`
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE],
* [CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE],
* [StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE],
@@ -1873,12 +1859,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed argument can be assigned to its corresponding parameter.
+ * Verify that the given [argument] can be assigned to its corresponding
+ * parameter.
*
- * This method corresponds to BestPracticesVerifier.checkForArgumentTypeNotAssignableForArgument.
+ * This method corresponds to
+ * [BestPracticesVerifier.checkForArgumentTypeNotAssignableForArgument].
*
- * @param argument the argument to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE].
*/
bool _checkForArgumentTypeNotAssignableForArgument(Expression argument) {
@@ -1893,15 +1879,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed expression can be assigned to its corresponding parameters.
+ * Verify that the given [expression] can be assigned to its corresponding
+ * parameters. The [expectedStaticType] is the expected static type. The
+ * [expectedPropagatedType] is the expected propagated type, may be `null`.
*
* This method corresponds to
- * BestPracticesVerifier.checkForArgumentTypeNotAssignableWithExpectedTypes.
+ * [BestPracticesVerifier.checkForArgumentTypeNotAssignableWithExpectedTypes].
*
- * @param expression the expression to evaluate
- * @param expectedStaticType the expected static type
- * @param expectedPropagatedType the expected propagated type, may be `null`
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE],
* [CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE],
* [StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE],
@@ -1916,12 +1900,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
expression, expectedStaticType, getStaticType(expression), errorCode);
/**
- * This verifies that the passed arguments can be assigned to their corresponding parameters.
+ * Verify that the arguments in the given [argumentList] can be assigned to
+ * their corresponding parameters.
*
- * This method corresponds to BestPracticesVerifier.checkForArgumentTypesNotAssignableInList.
+ * This method corresponds to
+ * [BestPracticesVerifier.checkForArgumentTypesNotAssignableInList].
*
- * @param node the arguments to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE].
*/
bool _checkForArgumentTypesNotAssignableInList(ArgumentList argumentList) {
@@ -1938,14 +1922,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check that the static type of the given expression is assignable to the given type. If it
- * isn't, report an error with the given error code.
- *
- * @param expression the expression being tested
- * @param type the type that the expression must be assignable to
- * @param errorCode the error code to be reported
- * @param arguments the arguments to pass in when creating the error
- * @return `true` if an error was reported
+ * Check that the static type of the given expression is assignable to the
+ * given type. If it isn't, report an error with the given error code. The
+ * [type] is the type that the expression must be assignable to. The
+ * [errorCode] is the error code to be reported. The [arguments] are the
+ * arguments to pass in when creating the error.
*/
bool _checkForAssignability(Expression expression, InterfaceType type,
ErrorCode errorCode, List<Object> arguments) {
@@ -1964,10 +1945,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed expression is not final.
+ * Verify that the given [expression] is not final.
*
- * @param node the expression to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ASSIGNMENT_TO_CONST],
* [StaticWarningCode.ASSIGNMENT_TO_FINAL], and
* [StaticWarningCode.ASSIGNMENT_TO_METHOD].
@@ -2026,16 +2005,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed identifier is not a keyword, and generates the passed error code
- * on the identifier if it is a keyword.
+ * Verify that the given [identifier] is not a keyword, and generates the
+ * given [errorCode] on the identifier if it is a keyword.
*
- * @param identifier the identifier to check to ensure that it is not a keyword
- * @param errorCode if the passed identifier is a keyword then this error code is created on the
- * identifier, the error code will be one of
- * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME],
- * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME] or
- * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME],
* [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME], and
* [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME].
@@ -2052,11 +2024,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the given switch case is terminated with 'break', 'continue', 'return' or
- * 'throw'.
+ * Verify that the given [switchCase] is terminated with 'break', 'continue',
+ * 'return' or 'throw'.
*
- * @param node the switch case to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* see [StaticWarningCode.CASE_BLOCK_NOT_TERMINATED].
*/
bool _checkForCaseBlockNotTerminated(SwitchCase node) {
@@ -2096,11 +2066,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the switch cases in the given switch statement is terminated with 'break',
- * 'continue', 'return' or 'throw'.
+ * Verify that the switch cases in the given switch [statement] are terminated
+ * with 'break', 'continue', 'return' or 'throw'.
*
- * @param node the switch statement containing the cases to be checked
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CASE_BLOCK_NOT_TERMINATED].
*/
bool _checkForCaseBlocksNotTerminated(SwitchStatement node) {
@@ -2117,11 +2085,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed method declaration is abstract only if the enclosing class is
- * also abstract.
+ * Verify that the given [method] declaration is abstract only if the
+ * enclosing class is also abstract.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER].
*/
bool _checkForConcreteClassWithAbstractMember(MethodDeclaration node) {
@@ -2154,12 +2120,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies all possible conflicts of the constructor name with other constructors and
- * members of the same class.
+ * Verify all possible conflicts of the given [constructor]'s name with other
+ * constructors and members of the same class. The [constructorElement] is the
+ * constructor's element.
*
- * @param node the constructor declaration to evaluate
- * @param constructorElement the constructor element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT],
* [CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME],
* [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD], and
@@ -2212,10 +2176,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the [enclosingClass] does not have a method and getter pair with the
- * same name on, via inheritance.
+ * Verify that the [enclosingClass] does not have a method and getter pair
+ * with the same name on, via inheritance.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD], and
* [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER].
*/
@@ -2270,12 +2233,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the superclass of the [enclosingClass] does not declare accessible
- * static members with the same name as the instance getters/setters declared in
- * [enclosingClass].
+ * Verify that the superclass of the [enclosingClass] does not declare
+ * accessible static members with the same name as the instance
+ * getters/setters declared in [enclosingClass].
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER], and
* [StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER].
*/
@@ -2339,13 +2300,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the enclosing class does not have a setter with the same name as the passed
- * instance method declaration.
+ * Verify that the enclosing class does not have a setter with the same name
+ * as the given instance method declaration.
*
- * TODO(jwren) add other "conflicting" error codes into algorithm/ data structure
+ * TODO(jwren) add other "conflicting" error codes into algorithm/ data
+ * structure.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER].
*/
bool _checkForConflictingInstanceMethodSetter(ClassDeclaration node) {
@@ -2436,11 +2396,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the enclosing class does not have an instance member with the same name as
- * the passed static getter method declaration.
+ * Verify that the enclosing class does not have an instance member with the
+ * same name as the given static [method] declaration.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER].
*/
bool _checkForConflictingStaticGetterAndInstanceSetter(
@@ -2480,11 +2438,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the enclosing class does not have an instance member with the same name as
- * the passed static getter method declaration.
+ * Verify that the enclosing class does not have an instance member with the
+ * same name as the given static [method] declaration.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER].
*/
bool _checkForConflictingStaticSetterAndInstanceMember(
@@ -2530,10 +2486,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies all conflicts between type variable and enclosing class. TODO(scheglov)
+ * Verify all conflicts between type variable and enclosing class.
+ * TODO(scheglov)
*
- * @param node the class declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS], and
* [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER].
*/
@@ -2562,11 +2517,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that if the passed constructor declaration is 'const' then there are no
- * invocations of non-'const' super constructors.
+ * Verify that if the given [constructor] declaration is 'const' then there
+ * are no invocations of non-'const' super constructors.
*
- * @param node the constructor declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER].
*/
bool _checkForConstConstructorWithNonConstSuper(ConstructorDeclaration node) {
@@ -2621,12 +2574,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that if the passed constructor declaration is 'const' then there are no non-final
- * instance variable.
+ * Verify that if the given constructor [declaration] is 'const' then there
+ * are no non-final instance variable. The [constructorElement] is the
+ * constructor element.
*
- * @param node the constructor declaration to evaluate
- * @param constructorElement the constructor element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD].
*/
bool _checkForConstConstructorWithNonFinalField(
@@ -2646,13 +2597,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed 'const' instance creation expression is not creating a deferred
- * type.
+ * Verify that the given 'const' instance creation [expression] is not
+ * creating a deferred type. The [constructorName] is the constructor name,
+ * always non-`null`. The [typeName] is the name of the type defining the
+ * constructor, always non-`null`.
*
- * @param node the instance creation expression to evaluate
- * @param constructorName the constructor name, always non-`null`
- * @param typeName the name of the type defining the constructor, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_DEFERRED_CLASS].
*/
bool _checkForConstDeferredClass(InstanceCreationExpression node,
@@ -2667,11 +2616,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed throw expression is not enclosed in a 'const' constructor
- * declaration.
+ * Verify that the given throw [expression] is not enclosed in a 'const'
+ * constructor declaration.
*
- * @param node the throw expression expression to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION].
*/
bool _checkForConstEvalThrowsException(ThrowExpression node) {
@@ -2684,10 +2631,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed normal formal parameter is not 'const'.
+ * Verify that the given normal formal [parameter] is not 'const'.
*
- * @param node the normal formal parameter to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_FORMAL_PARAMETER].
*/
bool _checkForConstFormalParameter(NormalFormalParameter node) {
@@ -2700,14 +2645,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed instance creation expression is not being invoked on an abstract
- * class.
+ * Verify that the given instance creation [expression] is not being invoked
+ * on an abstract class. The [typeName] is the [TypeName] of the
+ * [ConstructorName] from the [InstanceCreationExpression], this is the AST
+ * node that the error is attached to. The [type] is the type being
+ * constructed with this [InstanceCreationExpression].
*
- * @param node the instance creation expression to evaluate
- * @param typeName the [TypeName] of the [ConstructorName] from the
- * [InstanceCreationExpression], this is the AST node that the error is attached to
- * @param type the type being constructed with this [InstanceCreationExpression]
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.CONST_WITH_ABSTRACT_CLASS], and
* [StaticWarningCode.NEW_WITH_ABSTRACT_CLASS].
*/
@@ -2730,13 +2673,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed instance creation expression is not being invoked on an enum.
+ * Verify that the given instance creation [expression] is not being invoked
+ * on an enum. The [typeName] is the [TypeName] of the [ConstructorName] from
+ * the [InstanceCreationExpression], this is the AST node that the error is
+ * attached to. The [type] is the type being constructed with this
+ * [InstanceCreationExpression].
*
- * @param node the instance creation expression to verify
- * @param typeName the [TypeName] of the [ConstructorName] from the
- * [InstanceCreationExpression], this is the AST node that the error is attached to
- * @param type the type being constructed with this [InstanceCreationExpression]
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.INSTANTIATE_ENUM].
*/
bool _checkForConstOrNewWithEnum(
@@ -2750,13 +2692,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed 'const' instance creation expression is not being invoked on a
- * constructor that is not 'const'.
+ * Verify that the given 'const' instance creation [expression] is not being
+ * invoked on a constructor that is not 'const'.
*
- * This method assumes that the instance creation was tested to be 'const' before being called.
+ * This method assumes that the instance creation was tested to be 'const'
+ * before being called.
*
- * @param node the instance creation expression to verify
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_WITH_NON_CONST].
*/
bool _checkForConstWithNonConst(InstanceCreationExpression node) {
@@ -2770,10 +2711,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type name does not reference any type parameters.
+ * Verify that the given [typeName] does not reference any type parameters.
*
- * @param typeName the type name to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS].
*/
bool _checkForConstWithTypeParameters(TypeName typeName) {
@@ -2806,15 +2745,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that if the passed 'const' instance creation expression is being invoked on the
- * resolved constructor.
+ * Verify that if the given 'const' instance creation [expression] is being
+ * invoked on the resolved constructor. The [constructorName] is the
+ * constructor name, always non-`null`. The [typeName] is the name of the type
+ * defining the constructor, always non-`null`.
*
- * This method assumes that the instance creation was tested to be 'const' before being called.
+ * This method assumes that the instance creation was tested to be 'const'
+ * before being called.
*
- * @param node the instance creation expression to evaluate
- * @param constructorName the constructor name, always non-`null`
- * @param typeName the name of the type defining the constructor, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR], and
* [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT].
*/
@@ -2850,10 +2788,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that there are no default parameters in the passed function type alias.
+ * Verify that there are no default parameters in the given function type
+ * [alias].
*
- * @param node the function type alias to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS].
*/
bool _checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias node) {
@@ -2874,11 +2811,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the given default formal parameter is not part of a function typed
- * parameter.
+ * Verify that the given default formal [parameter] is not part of a function
+ * typed parameter.
*
- * @param node the default formal parameter to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER].
*/
bool _checkForDefaultValueInFunctionTypedParameter(
@@ -2898,10 +2833,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that any deferred imports in the given compilation unit have a unique prefix.
+ * Verify that any deferred imports in the given compilation [unit] have a
+ * unique prefix.
*
- * @param node the compilation unit containing the imports to be checked
- * @return `true` if an error was generated
* See [CompileTimeErrorCode.SHARED_DEFERRED_PREFIX].
*/
bool _checkForDeferredPrefixCollisions(CompilationUnit node) {
@@ -2941,10 +2875,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the enclosing class does not have an instance member with the given name of
- * the static member.
+ * Verify that the enclosing class does not have an instance member with the
+ * given name of the static member.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE].
*/
bool _checkForDuplicateDefinitionInheritance() {
@@ -2966,11 +2899,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the enclosing class does not have an instance member with the given name of
- * the static member.
+ * Verify that the enclosing class does not have an instance member with the
+ * given name of the [staticMember].
*
- * @param staticMember the static member to check conflict for
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE].
*/
bool _checkForDuplicateDefinitionOfMember(ExecutableElement staticMember) {
@@ -3006,11 +2937,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies if the passed list literal has type arguments then there is exactly one.
+ * Verify that if the given list [literal] has type arguments then there is
+ * exactly one. The [typeArguments] are the type arguments.
*
- * @param node the list literal to evaluate
- * @param typeArguments the type arguments, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS].
*/
bool _checkForExpectedOneListTypeArgument(
@@ -3028,13 +2957,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed import has unique name among other exported libraries.
+ * Verify that the given export ([node]) has a unique name among other
+ * exported libraries. The [exportElement] is the [ExportElement] retrieved
+ * from the node, if the element in the node was `null`, then this method is
+ * not called. The [exportedLibrary] is the library element containing the
+ * exported element.
*
- * @param node the export directive to evaluate
- * @param exportElement the [ExportElement] retrieved from the node, if the element in the
- * node was `null`, then this method is not called
- * @param exportedLibrary the library element containing the exported element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXPORT_DUPLICATED_LIBRARY_NAME].
*/
bool _checkForExportDuplicateLibraryName(ExportDirective node,
@@ -3071,13 +2999,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check that if the visiting library is not system, then any passed library should not be SDK
- * internal library.
+ * Check that if the visiting library is not system, then any given library
+ * should not be SDK internal library. The [exportElement] is the
+ * [ExportElement] retrieved from the node, if the element in the node was
+ * `null`, then this method is not called.
*
- * @param node the export directive to evaluate
- * @param exportElement the [ExportElement] retrieved from the node, if the element in the
- * node was `null`, then this method is not called
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY].
*/
bool _checkForExportInternalLibrary(
@@ -3102,10 +3028,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed extends clause does not extend a deferred class.
+ * Verify that the given extends [clause] does not extend a deferred class.
*
- * @param node the extends clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS].
*/
bool _checkForExtendsDeferredClass(ExtendsClause node) {
@@ -3117,10 +3041,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type alias does not extend a deferred class.
+ * Verify that the given type [alias] does not extend a deferred class.
*
- * @param node the extends clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS].
*/
bool _checkForExtendsDeferredClassInTypeAlias(ClassTypeAlias node) {
@@ -3132,10 +3054,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed extends clause does not extend classes such as num or String.
+ * Verify that the given extends [clause] does not extend classes such as
+ * 'num' or 'String'.
*
- * @param node the extends clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS].
*/
bool _checkForExtendsDisallowedClass(ExtendsClause node) {
@@ -3147,10 +3068,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type alias does not extend classes such as num or String.
+ * Verify that the given type [alias] does not extend classes such as 'num' or
+ * 'String'.
*
- * @param node the extends clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS].
*/
bool _checkForExtendsDisallowedClassInTypeAlias(ClassTypeAlias node) {
@@ -3162,11 +3082,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type name does not extend, implement or mixin classes that are
- * deferred.
+ * Verify that the given [typeName] does not extend, implement or mixin
+ * classes that are deferred.
*
- * @param node the type name to test
- * @return `true` if and only if an error code is generated on the passed node
* See [_checkForExtendsDeferredClass],
* [_checkForExtendsDeferredClassInTypeAlias],
* [_checkForImplementsDeferredClass],
@@ -3189,11 +3107,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type name does not extend, implement or mixin classes such as
- * 'num' or 'String'.
+ * Verify that the given [typeName] does not extend, implement or mixin
+ * classes such as 'num' or 'String'.
*
- * @param node the type name to test
- * @return `true` if and only if an error code is generated on the passed node
* See [_checkForExtendsDisallowedClass],
* [_checkForExtendsDisallowedClassInTypeAlias],
* [_checkForImplementsDisallowedClass],
@@ -3240,13 +3156,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed constructor field initializer has compatible field and
- * initializer expression types.
+ * Verify that the given constructor field [initializer] has compatible field
+ * and initializer expression types. The [staticElement] is the static element
+ * from the name in the [ConstructorFieldInitializer].
*
- * @param node the constructor field initializer to test
- * @param staticElement the static element from the name in the
- * [ConstructorFieldInitializer]
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE], and
* [StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE].
*/
@@ -3311,10 +3224,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed field formal parameter is in a constructor declaration.
+ * Verify that the given field formal [parameter] is in a constructor
+ * declaration.
*
- * @param node the field formal parameter to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR].
*/
bool _checkForFieldInitializingFormalRedirectingConstructor(
@@ -3346,14 +3258,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed variable declaration list has only initialized variables if the
- * list is final or const. This method is called by
- * [checkForFinalNotInitializedInClass],
- * [visitTopLevelVariableDeclaration] and
- * [visitVariableDeclarationStatement].
+ * Verify that the given variable declaration [list] has only initialized
+ * variables if the list is final or const.
*
- * @param node the class declaration to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_NOT_INITIALIZED], and
* [StaticWarningCode.FINAL_NOT_INITIALIZED].
*/
@@ -3383,12 +3290,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that final fields that are declared, without any constructors in the enclosing
- * class, are initialized. Cases in which there is at least one constructor are handled at the end
- * of [checkForAllFinalInitializedErrorCodes].
+ * Verify that final fields in the given clas [declaration] that are declared,
+ * without any constructors in the enclosing class, are initialized. Cases in
+ * which there is at least one constructor are handled at the end of
+ * [_checkForAllFinalInitializedErrorCodes].
*
- * @param node the class declaration to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.CONST_NOT_INITIALIZED], and
* [StaticWarningCode.FINAL_NOT_INITIALIZED].
*/
@@ -3444,10 +3350,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed implements clause does not implement classes that are deferred.
+ * Verify that the given implements [clause] does not implement classes that
+ * are deferred.
*
- * @param node the implements clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS].
*/
bool _checkForImplementsDeferredClass(ImplementsClause node) {
@@ -3465,11 +3370,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed implements clause does not implement classes such as 'num' or
- * 'String'.
+ * Verify that the given implements [clause] does not implement classes such
+ * as 'num' or 'String'.
*
- * @param node the implements clause to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS].
*/
bool _checkForImplementsDisallowedClass(ImplementsClause node) {
@@ -3487,11 +3390,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that if the passed identifier is part of constructor initializer, then it does
- * not reference implicitly 'this' expression.
+ * Verify that if the given [identifier] is part of a constructor initializer,
+ * then it does not implicitly reference 'this' expression.
*
- * @param node the simple identifier to test
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER], and
* [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC].
* TODO(scheglov) rename thid method
@@ -3560,12 +3461,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed import has unique name among other imported libraries.
+ * Verify that the given import [directive] has a unique name among other
+ * imported libraries. The [importElement] is the [ImportElement] retrieved
+ * from the node, if the element in the node was `null`, then this method is
+ * not called.
*
- * @param node the import directive to evaluate
- * @param importElement the [ImportElement] retrieved from the node, if the element in the
- * node was `null`, then this method is not called
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPORT_DUPLICATED_LIBRARY_NAME].
*/
bool _checkForImportDuplicateLibraryName(
@@ -3604,13 +3504,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check that if the visiting library is not system, then any passed library should not be SDK
- * internal library.
+ * Check that if the visiting library is not system, then any given library
+ * should not be SDK internal library. The [importElement] is the
+ * [ImportElement] retrieved from the node, if the element in the node was
+ * `null`, then this method is not called
*
- * @param node the import directive to evaluate
- * @param importElement the [ImportElement] retrieved from the node, if the element in the
- * node was `null`, then this method is not called
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY].
*/
bool _checkForImportInternalLibrary(
@@ -3635,10 +3533,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * For each class declaration, this method is called which verifies that all inherited members are
- * inherited consistently.
+ * For each class declaration, this method is called which verifies that all
+ * inherited members are inherited consistently.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE].
*/
bool _checkForInconsistentMethodInheritance() {
@@ -3658,14 +3555,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the given "typeReference" is not a type reference and that then the "name" is
- * reference to an instance member.
+ * Check that the given [typeReference] is not a type reference and that then
+ * the [name] is reference to an instance member.
*
- * @param typeReference the resolved [ClassElement] of the left hand side of the expression,
- * or `null`, aka, the class element of 'C' in 'C.x', see
- * [getTypeReference]
- * @param name the accessed name to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER].
*/
bool _checkForInstanceAccessToStaticMember(
@@ -3700,12 +3592,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks whether the given [executableElement] collides with the name of a static
- * method in one of its superclasses, and reports the appropriate warning if it does.
+ * Check whether the given [executableElement] collides with the name of a
+ * static method in one of its superclasses, and reports the appropriate
+ * warning if it does. The [errorNameTarget] is the node to report problems
+ * on.
*
- * @param executableElement the method to check.
- * @param errorNameTarget the node to report problems on.
- * @return `true` if and only if a warning was generated.
* See [StaticTypeWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC].
*/
bool _checkForInstanceMethodNameCollidesWithSuperclassStatic(
@@ -3775,12 +3666,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that an 'int' can be assigned to the parameter corresponding to the given
- * expression. This is used for prefix and postfix expressions where the argument value is
- * implicit.
+ * Verify that an 'int' can be assigned to the parameter corresponding to the
+ * given [expression]. This is used for prefix and postfix expressions where
+ * the argument value is implicit.
*
- * @param argument the expression to which the operator is being applied
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE].
*/
bool _checkForIntNotAssignable(Expression argument) {
@@ -3795,10 +3684,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed [Annotation] isn't defined in a deferred library.
+ * Verify that the given [annotation] isn't defined in a deferred library.
*
- * @param node the [Annotation]
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY].
*/
bool _checkForInvalidAnnotationFromDeferredLibrary(Annotation node) {
@@ -3815,11 +3702,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed left hand side and right hand side represent a valid assignment.
+ * Verify that the given left hand side ([lhs]) and right hand side ([rhs])
+ * represent a valid assignment.
*
- * @param lhs the left hand side expression
- * @param rhs the right hand side expression
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.INVALID_ASSIGNMENT].
*/
bool _checkForInvalidAssignment(Expression lhs, Expression rhs) {
@@ -3843,13 +3728,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Given an assignment using a compound assignment operator, this verifies that the given
- * assignment is valid.
+ * Given an [assignment] using a compound assignment operator, this verifies
+ * that the given assignment is valid. The [lhs] is the left hand side
+ * expression. The [rhs] is the right hand side expression.
*
- * @param node the assignment expression being tested
- * @param lhs the left hand side expression
- * @param rhs the right hand side expression
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.INVALID_ASSIGNMENT].
*/
bool _checkForInvalidCompoundAssignment(
@@ -3878,12 +3760,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check the given initializer to ensure that the field being initialized is a valid field.
- *
- * @param node the field initializer being checked
- * @param fieldName the field name from the [ConstructorFieldInitializer]
- * @param staticElement the static element from the name in the
- * [ConstructorFieldInitializer]
+ * Check the given [initializer] to ensure that the field being initialized is
+ * a valid field. The [fieldName] is the field name from the
+ * [ConstructorFieldInitializer]. The [staticElement] is the static element
+ * from the name in the [ConstructorFieldInitializer].
*/
void _checkForInvalidField(ConstructorFieldInitializer node,
SimpleIdentifier fieldName, Element staticElement) {
@@ -3907,12 +3787,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check to see whether the given function body has a modifier associated with it, and report it
- * as an error if it does.
- *
- * @param body the function body being checked
- * @param errorCode the error code to be reported if a modifier is found
- * @return `true` if an error was reported
+ * Check to see whether the given function [body] has a modifier associated
+ * with it, and report it as an error if it does.
*/
bool _checkForInvalidModifierOnBody(
FunctionBody body, CompileTimeErrorCode errorCode) {
@@ -3925,10 +3801,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the usage of the passed 'this' is valid.
+ * Verify that the usage of the given 'this' is valid.
*
- * @param node the 'this' expression to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS].
*/
bool _checkForInvalidReferenceToThis(ThisExpression node) {
@@ -3941,14 +3815,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Checks to ensure that the passed [ListLiteral] or [MapLiteral] does not have a type
- * parameter as a type argument.
- *
- * @param arguments a non-`null`, non-empty [TypeName] node list from the respective
- * [ListLiteral] or [MapLiteral]
- * @param errorCode either [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST] or
- * [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]
- * @return `true` if and only if an error code is generated on the passed node
+ * Checks to ensure that the given list of type [arguments] does not have a
+ * type parameter as a type argument. The [errorCode] is either
+ * [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST] or
+ * [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP].
*/
bool _checkForInvalidTypeArgumentInConstTypedLiteral(
NodeList<TypeName> arguments, ErrorCode errorCode) {
@@ -3963,12 +3833,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the elements given [ListLiteral] are subtypes of the specified element
- * type.
+ * Verify that the elements given [ListLiteral] are subtypes of the specified
+ * element type. The [typeArguments] are the type arguments.
*
- * @param node the list literal to evaluate
- * @param typeArguments the type arguments, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE], and
* [StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE].
*/
@@ -4001,12 +3868,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the key/value of entries of the given [MapLiteral] are subtypes of the
- * key/value types specified in the type arguments.
+ * Verify that the key/value of entries of the given map [literal] are
+ * subtypes of the key/value types specified in the type arguments. The
+ * [typeArguments] are the type arguments.
*
- * @param node the map literal to evaluate
- * @param typeArguments the type arguments, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE],
* [CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE],
* [StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE], and
@@ -4053,10 +3918,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the [enclosingClass] does not define members with the same name as
- * the enclosing class.
+ * Verify that the [enclosingClass] does not define members with the same name
+ * as the enclosing class.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME].
*/
bool _checkForMemberWithClassName() {
@@ -4083,11 +3947,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check to make sure that all similarly typed accessors are of the same type (including inherited
- * accessors).
+ * Check to make sure that all similarly typed accessors are of the same type
+ * (including inherited accessors).
*
- * @param node the accessor currently being visited
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES], and
* [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE].
*/
@@ -4177,11 +4039,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Check to make sure that switch statements whose static type is an enum type either have a
- * default case or include all of the enum constants.
- *
- * @param statement the switch statement to check
- * @return `true` if and only if an error code is generated on the passed node
+ * Check to make sure that the given switch [statement] whose static type is
+ * an enum type either have a default case or include all of the enum
+ * constants.
*/
bool _checkForMissingEnumConstantInSwitch(SwitchStatement statement) {
// TODO(brianwilkerson) This needs to be checked after constant values have
@@ -4233,11 +4093,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the given function body does not contain return statements that both have
- * and do not have return values.
+ * Verify that the given function [body] does not contain return statements
+ * that both have and do not have return values.
*
- * @param node the function body being tested
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.MIXED_RETURN_TYPES].
*/
bool _checkForMixedReturns(BlockFunctionBody node) {
@@ -4261,11 +4119,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed mixin does not have an explicitly declared constructor.
+ * Verify that the given mixin does not have an explicitly declared
+ * constructor. The [mixinName] is the node to report problem on. The
+ * [mixinElement] is the mixing to evaluate.
*
- * @param mixinName the node to report problem on
- * @param mixinElement the mixing to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR].
*/
bool _checkForMixinDeclaresConstructor(
@@ -4282,11 +4139,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed mixin has the 'Object' superclass.
+ * Verify that the given mixin has the 'Object' superclass. The [mixinName] is
+ * the node to report problem on. The [mixinElement] is the mixing to
+ * evaluate.
*
- * @param mixinName the node to report problem on
- * @param mixinElement the mixing to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT].
*/
bool _checkForMixinInheritsNotFromObject(
@@ -4305,11 +4161,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed mixin does not reference 'super'.
+ * Verify that the given mixin does not reference 'super'. The [mixinName] is
+ * the node to report problem on. The [mixinElement] is the mixing to
+ * evaluate.
*
- * @param mixinName the node to report problem on
- * @param mixinElement the mixing to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER].
*/
bool _checkForMixinReferencesSuper(
@@ -4323,10 +4178,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed constructor has at most one 'super' initializer.
+ * Verify that the given [constructor] has at most one 'super' initializer.
*
- * @param node the constructor declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS].
*/
bool _checkForMultipleSuperInitializers(ConstructorDeclaration node) {
@@ -4344,10 +4197,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Checks to ensure that native function bodies can only in SDK code.
+ * Checks to ensure that the given native function [body] is in SDK code.
*
- * @param node the native function body to test
- * @return `true` if and only if an error code is generated on the passed node
* See [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE].
*/
bool _checkForNativeFunctionBodyInNonSDKCode(NativeFunctionBody node) {
@@ -4360,14 +4211,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed 'new' instance creation expression invokes existing constructor.
+ * Verify that the given instance creation [expression] invokes an existing
+ * constructor. The [constructorName] is the constructor name. The [typeName]
+ * is the name of the type defining the constructor.
*
- * This method assumes that the instance creation was tested to be 'new' before being called.
+ * This method assumes that the instance creation was tested to be 'new'
+ * before being called.
*
- * @param node the instance creation expression to evaluate
- * @param constructorName the constructor name, always non-`null`
- * @param typeName the name of the type defining the constructor, always non-`null`
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR].
*/
bool _checkForNewWithUndefinedConstructor(InstanceCreationExpression node,
@@ -4403,11 +4253,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the passed class declaration implicitly calls default constructor of its
- * superclass, there should be such default constructor - implicit or explicit.
+ * Check that if the given class [declaration] implicitly calls default
+ * constructor of its superclass, there should be such default constructor -
+ * implicit or explicit.
*
- * @param node the [ClassDeclaration] to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT].
*/
bool _checkForNoDefaultSuperConstructorImplicit(ClassDeclaration node) {
@@ -4451,12 +4300,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that passed class declaration overrides all members required by its superclasses
- * and interfaces.
+ * Check that the given class declaration overrides all members required by
+ * its superclasses and interfaces. The [classNameNode] is the
+ * [SimpleIdentifier] to be used if there is a violation, this is either the
+ * named from the [ClassDeclaration] or from the [ClassTypeAlias].
*
- * @param classNameNode the [SimpleIdentifier] to be used if there is a violation, this is
- * either the named from the [ClassDeclaration] or from the [ClassTypeAlias].
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE],
* [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO],
* [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE],
@@ -4629,11 +4477,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Checks to ensure that the expressions that need to be of type bool, are. Otherwise an error is
- * reported on the expression.
+ * Check to ensure that the [condition] is of type bool, are. Otherwise an
+ * error is reported on the expression.
*
- * @param condition the conditional expression to test
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.NON_BOOL_CONDITION].
*/
bool _checkForNonBoolCondition(Expression condition) {
@@ -4647,10 +4493,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed assert statement has either a 'bool' or '() -> bool' input.
+ * Verify that the given assert [statement] has either a 'bool' or
+ * '() -> bool' input.
*
- * @param node the assert statement to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.NON_BOOL_EXPRESSION].
*/
bool _checkForNonBoolExpression(AssertStatement node) {
@@ -4675,10 +4520,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Checks to ensure that the given expression is assignable to bool.
+ * Checks to ensure that the given [expression] is assignable to bool.
*
- * @param expression the expression expression to test
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION].
*/
bool _checkForNonBoolNegationExpression(Expression expression) {
@@ -4692,13 +4535,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed map literal either:
+ * Verify the given map [literal] either:
* * has `const modifier`
* * has explicit type arguments
* * is not start of the statement
*
- * @param node the map literal to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT].
*/
bool _checkForNonConstMapAsExpressionStatement(MapLiteral node) {
@@ -4727,11 +4568,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed method declaration of operator `[]=`, has `void` return
- * type.
+ * Verify that the given method [declaration] of operator `[]=`, has `void`
+ * return type.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR].
*/
bool _checkForNonVoidReturnTypeForOperator(MethodDeclaration node) {
@@ -4754,10 +4593,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed setter has no return type or the `void` return type.
+ * Verify the given setter has no return type or the `void` return type.
*
- * @param typeName the type name to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER].
*/
bool _checkForNonVoidReturnTypeForSetter(TypeName typeName) {
@@ -4772,13 +4609,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed operator-method declaration, does not have an optional parameter.
- *
- * This method assumes that the method declaration was tested to be an operator declaration before
- * being called.
+ * Verify the given operator-method [declaration], does not have an optional
+ * parameter. This method assumes that the method declaration was tested to be
+ * an operator declaration before being called.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR].
*/
bool _checkForOptionalParameterInOperator(MethodDeclaration node) {
@@ -4800,10 +4634,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks for named optional parameters that begin with '_'.
+ * Check that the given named optional [parameter] does not begin with '_'.
*
- * @param node the default formal parameter to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER].
*/
bool _checkForPrivateOptionalParameter(FormalParameter node) {
@@ -4823,12 +4655,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks if the passed constructor declaration is the redirecting generative constructor and
- * references itself directly or indirectly.
+ * Check whether the given constructor [declaration] is the redirecting
+ * generative constructor and references itself directly or indirectly. The
+ * [constructorElement] is the constructor element.
*
- * @param node the constructor declaration to evaluate
- * @param constructorElement the constructor element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT].
*/
bool _checkForRecursiveConstructorRedirect(
@@ -4856,12 +4686,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks if the passed constructor declaration has redirected constructor and references
- * itself directly or indirectly.
+ * Check whether the given constructor [declaration] has redirected
+ * constructor and references itself directly or indirectly. The
+ * [constructorElement] is the constructor element.
*
- * @param node the constructor declaration to evaluate
- * @param constructorElement the constructor element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT].
*/
bool _checkForRecursiveFactoryRedirect(
@@ -4883,10 +4711,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the class declaration is not a superinterface to itself.
+ * Check that the class [element] is not a superinterface to itself.
*
- * @param classElt the class element to test
- * @return `true` if and only if an error code is generated on the passed element
* See [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE],
* [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS], and
* [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS].
@@ -4900,11 +4726,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the passed constructor declaration has a valid combination of redirected
- * constructor invocation(s), super constructor invocations and field initializers.
+ * Check that the given constructor [declaration] has a valid combination of
+ * redirected constructor invocation(s), super constructor invocations and
+ * field initializers.
*
- * @param node the constructor declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR],
* [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR],
* [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS],
@@ -4983,12 +4808,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks if the passed constructor declaration has redirected constructor and references
- * itself directly or indirectly.
+ * Check whether the given constructor [declaration] has redirected
+ * constructor and references itself directly or indirectly. The
+ * [constructorElement] is the constructor element.
*
- * @param node the constructor declaration to evaluate
- * @param constructorElement the constructor element
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR].
*/
bool _checkForRedirectToNonConstConstructor(
@@ -5024,10 +4847,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that the rethrow is inside of a catch clause.
+ * Check that the given rethrow [expression] is inside of a catch clause.
*
- * @param node the rethrow expression to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH].
*/
bool _checkForRethrowOutsideCatch(RethrowExpression node) {
@@ -5040,11 +4861,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the the given constructor declaration is generative, then it does not have
- * an expression function body.
+ * Check that if the the given constructor [declaration] is generative, then
+ * it does not have an expression function body.
*
- * @param node the constructor to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR].
*/
bool _checkForReturnInGenerativeConstructor(ConstructorDeclaration node) {
@@ -5064,15 +4883,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that a type mis-match between the return type and the expressed return type by the
- * enclosing method or function.
+ * Check that a type mis-match between the type of the [returnExpression] and
+ * the [expectedReturnType] by the enclosing method or function.
*
- * This method is called both by [checkForAllReturnStatementErrorCodes]
+ * This method is called both by [_checkForAllReturnStatementErrorCodes]
* and [visitExpressionFunctionBody].
*
- * @param returnExpression the returned expression to evaluate
- * @param expectedReturnType the expressed return type by the enclosing method or function
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE].
*/
bool _checkForReturnOfInvalidType(
@@ -5128,14 +4944,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks the given "typeReference" and that the "name" is not the reference to an instance
- * member.
+ * Check the given [typeReference] and that the [name] is not the reference to
+ * an instance member.
*
- * @param typeReference the resolved [ClassElement] of the left hand side of the expression,
- * or `null`, aka, the class element of 'C' in 'C.x', see
- * [getTypeReference]
- * @param name the accessed name to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER].
*/
bool _checkForStaticAccessToInstanceMember(
@@ -5161,11 +4972,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that the type of the passed 'switch' expression is assignable to the type of the
- * 'case' members.
+ * Check that the type of the expression in the given 'switch' [statement] is
+ * assignable to the type of the 'case' members.
*
- * @param node the 'switch' statement to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE].
*/
bool _checkForSwitchExpressionNotAssignable(SwitchStatement node) {
@@ -5201,10 +5010,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed function type alias does not reference itself directly.
+ * Verify that the given function type [alias] does not reference itself
+ * directly.
*
- * @param node the function type alias to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF].
*/
bool _checkForTypeAliasCannotReferenceItself_function(
@@ -5219,10 +5027,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the passed type name is not a deferred type.
+ * Verify that the given type [name] is not a deferred type.
*
- * @param expression the expression to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS].
*/
bool _checkForTypeAnnotationDeferredClass(TypeName node) {
@@ -5234,10 +5040,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the type arguments in the passed type name are all within their bounds.
+ * Verify that the type arguments in the given type [name] are all within
+ * their bounds.
*
- * @param node the [TypeName] to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
*/
bool _checkForTypeArgumentNotMatchingBounds(TypeName node) {
@@ -5290,11 +5095,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the passed type name is a type parameter being used to define a static
- * member.
+ * Check whether the given type [name] is a type parameter being used to
+ * define a static member.
*
- * @param node the type name to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC].
*/
bool _checkForTypeParameterReferencedByStatic(TypeName node) {
@@ -5310,10 +5113,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the passed type parameter is a supertype of its bound.
+ * Check whether the given type [parameter] is a supertype of its bound.
*
- * @param node the type parameter to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND].
*/
bool _checkForTypeParameterSupertypeOfItsBound(TypeParameter node) {
@@ -5335,12 +5136,10 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the passed generative constructor has neither an explicit super constructor
- * invocation nor a redirecting constructor invocation, that the superclass has a default
- * generative constructor.
+ * Check that if the given generative [constructor] has neither an explicit
+ * super constructor invocation nor a redirecting constructor invocation, that
+ * the superclass has a default generative constructor.
*
- * @param node the constructor declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT],
* [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR], and
* [StaticWarningCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT].
@@ -5413,11 +5212,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This checks that if the given name is a reference to a static member it is defined in the
- * enclosing class rather than in a superclass.
+ * Check that if the given [name] is a reference to a static member it is
+ * defined in the enclosing class rather than in a superclass.
*
- * @param name the name to be evaluated
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER].
*/
bool _checkForUnqualifiedReferenceToNonLocalStaticMember(
@@ -5492,10 +5289,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the given getter does not have a return type of 'void'.
+ * Verify that the given [getter] does not have a return type of 'void'.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.VOID_RETURN_FOR_GETTER].
*/
bool _checkForVoidReturnType(MethodDeclaration node) {
@@ -5509,13 +5304,12 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies the passed operator-method declaration, has correct number of parameters.
+ * Verify the given operator-method [declaration], has correct number of
+ * parameters.
*
- * This method assumes that the method declaration was tested to be an operator declaration before
- * being called.
+ * This method assumes that the method declaration was tested to be an
+ * operator declaration before being called.
*
- * @param node the method declaration to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR].
*/
bool _checkForWrongNumberOfParametersForOperator(MethodDeclaration node) {
@@ -5573,13 +5367,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies if the passed setter parameter list have only one required parameter.
+ * Verify that the given setter [parameterList] has only one required
+ * parameter. The [setterName] is the name of the setter to report problems
+ * on.
*
- * This method assumes that the method declaration was tested to be a setter before being called.
+ * This method assumes that the method declaration was tested to be a setter
+ * before being called.
*
- * @param setterName the name of the setter to report problems on
- * @param parameterList the parameter list to evaluate
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER].
*/
bool _checkForWrongNumberOfParametersForSetter(
@@ -5656,10 +5450,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that if the given class declaration implements the class Function that it has a
- * concrete implementation of the call method.
+ * Verify that if the given class [declaration] implements the class Function
+ * that it has a concrete implementation of the call method.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [StaticWarningCode.FUNCTION_WITHOUT_CALL].
*/
bool _checkImplementsFunctionWithoutCall(ClassDeclaration node) {
@@ -5692,10 +5485,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * This verifies that the given class declaration does not have the same class in the 'extends'
- * and 'implements' clauses.
+ * Verify that the given class [declaration] does not have the same class in
+ * the 'extends' and 'implements' clauses.
*
- * @return `true` if and only if an error code is generated on the passed node
* See [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS].
*/
bool _checkImplementsSuperClass(ClassDeclaration node) {
@@ -5744,10 +5536,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Return the error code that should be used when the given class references itself directly.
- *
- * @param classElt the class that references itself
- * @return the error code that should be used
+ * Return the error code that should be used when the given class [element]
+ * references itself directly.
*/
ErrorCode _getBaseCaseErrorCode(ClassElement classElt) {
InterfaceType supertype = classElt.supertype;
@@ -5764,11 +5554,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Given an expression in a switch case whose value is expected to be an enum constant, return the
- * name of the constant.
- *
- * @param expression the expression from the switch case
- * @return the name of the constant referenced by the expression
+ * Given an [expression] in a switch case whose value is expected to be an
+ * enum constant, return the name of the constant.
*/
String _getConstantName(Expression expression) {
// TODO(brianwilkerson) Convert this to return the element representing the
@@ -5784,10 +5571,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Returns the Type (return type) for a given getter.
- *
- * @param propertyAccessorElement
- * @return The type of the given getter.
+ * Return the return type of the given [getter].
*/
DartType _getGetterType(PropertyAccessorElement propertyAccessorElement) {
FunctionType functionType = propertyAccessorElement.type;
@@ -5799,10 +5583,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Returns the Type (first and only parameter) for a given setter.
- *
- * @param propertyAccessorElement
- * @return The type of the given setter.
+ * Return the type of the first and only parameter of the given [setter].
*/
DartType _getSetterType(PropertyAccessorElement propertyAccessorElement) {
// Get the parameters for MethodDeclaration or FunctionDeclaration
@@ -5816,11 +5597,9 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Given a list of directives that have the same prefix, generate an error if there is more than
- * one import and any of those imports is deferred.
+ * Given a list of [directives] that have the same prefix, generate an error
+ * if there is more than one import and any of those imports is deferred.
*
- * @param directives the list of directives that have the same prefix
- * @return `true` if an error was generated
* See [CompileTimeErrorCode.SHARED_DEFERRED_PREFIX].
*/
bool _hasDeferredPrefixCollision(List<ImportDirective> directives) {
@@ -5840,7 +5619,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * @return `true` if the given constructor redirects to itself, directly or indirectly
+ * Return `true` if the given [constructor] redirects to itself, directly or
+ * indirectly.
*/
bool _hasRedirectingFactoryConstructorCycle(ConstructorElement element) {
Set<ConstructorElement> constructors = new HashSet<ConstructorElement>();
@@ -5859,8 +5639,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * @return <code>true</code> if given [Element] has direct or indirect reference to itself
- * from anywhere except [ClassElement] or type parameter bounds.
+ * Return `true` if the given [element] has direct or indirect reference to
+ * itself from anywhere except a class element or type parameter bounds.
*/
bool _hasTypedefSelfReference(Element target) {
Set<Element> checked = new HashSet<Element>();
@@ -5912,17 +5692,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Return `true` iff the passed [ClassElement] has a method, getter or setter that
- * matches the name of the passed [ExecutableElement] in either the class itself, or one of
- * its' mixins that is concrete.
+ * Return `true` iff the given class [element] has a method, getter or setter
+ * that matches the name of the given executable [element] in either the class
+ * itself, or one of its' mixins that is concrete.
*
- * By "match", only the name of the member is tested to match, it does not have to equal or be a
- * subtype of the passed executable element, this is due to the specific use where this method is
- * used in [checkForNonAbstractClassInheritsAbstractMember].
- *
- * @param executableElt the executable to search for in the passed class element
- * @param classElt the class method to search through the members of
- * @return `true` iff the passed member is found in the passed class element
+ * By "match", only the name of the member is tested to match, it does not
+ * have to equal or be a subtype of the given executable element, this is due
+ * to the specific use where this method is used in
+ * [_checkForNonAbstractClassInheritsAbstractMember].
*/
bool _isMemberInClassOrMixin(
ExecutableElement executableElt, ClassElement classElt) {
@@ -5968,8 +5745,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * @param node the 'this' expression to analyze
- * @return `true` if the given 'this' expression is in the valid context
+ * Return `true` if the given 'this' [expression] is in a valid context.
*/
bool _isThisInValidContext(ThisExpression node) {
for (AstNode n = node; n != null; n = n.parent) {
@@ -5990,12 +5766,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Return `true` if the given identifier is in a location where it is allowed to resolve to
- * a static member of a supertype.
- *
- * @param node the node being tested
- * @return `true` if the given identifier is in a location where it is allowed to resolve to
- * a static member of a supertype
+ * Return `true` if the given [identifier] is in a location where it is
+ * allowed to resolve to a static member of a supertype.
*/
bool _isUnqualifiedReferenceToNonLocalStaticMemberAllowed(
SimpleIdentifier node) {
@@ -6028,22 +5800,20 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
(result.value != null && result.value.isUserDefinedObject);
/**
- * This checks the class declaration is not a superinterface to itself.
+ * Check that the given class [element] is not a superinterface to itself. The
+ * [path] is a list containing the potentially cyclic implements path.
*
- * @param classElt the class element to test
- * @param path a list containing the potentially cyclic implements path
- * @return `true` if and only if an error code is generated on the passed element
* See [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE],
* [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS],
- * [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS], and
- * [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH].
+ * [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS],
+ * and [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH].
*/
bool _safeCheckForRecursiveInterfaceInheritance(
ClassElement classElt, List<ClassElement> path) {
// Detect error condition.
int size = path.length;
// If this is not the base case (size > 0), and the enclosing class is the
- // passed class element then an error an error.
+ // given class element then an error an error.
if (size > 0 && _enclosingClass == classElt) {
String enclosingClassName = _enclosingClass.displayName;
if (size > 1) {
@@ -6101,10 +5871,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Return the static type of the given expression that is to be used for type analysis.
- *
- * @param expression the expression whose type is to be returned
- * @return the static type of the given expression
+ * Return the static type of the given [expression] that is to be used for
+ * type analysis.
*/
static DartType getStaticType(Expression expression) {
DartType type = expression.staticType;
@@ -6116,11 +5884,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Return the variable element represented by the given expression, or `null` if there is no
- * such element.
- *
- * @param expression the expression whose element is to be returned
- * @return the variable element represented by the expression
+ * Return the variable element represented by the given [expression], or
+ * `null` if there is no such element.
*/
static VariableElement getVariableElement(Expression expression) {
if (expression is Identifier) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698