| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| index 16a41859bdc4b75883ef9e3287f36925221812d4..4e6d06e46eda019a5848c6d70a08ca7b0218d7cc 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| @@ -729,6 +729,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
| }
|
| }
|
| + checkForExpectedOneListTypeArgument(node);
|
| checkForListElementTypeNotAssignable(node);
|
| return super.visitListLiteral(node);
|
| }
|
| @@ -746,6 +747,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
| }
|
| }
|
| + checkExpectedTwoMapTypeArguments(typeArguments);
|
| checkForNonConstMapAsExpressionStatement(node);
|
| checkForMapTypeNotAssignable(node);
|
| checkForConstMapKeyExpressionTypeImplementsEquals(node);
|
| @@ -981,6 +983,31 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * This verifies if the passed map literal has type arguments then there is exactly two.
|
| + *
|
| + * @param node the map literal to evaluate
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see StaticTypeWarningCode#EXPECTED_TWO_MAP_TYPE_ARGUMENTS
|
| + */
|
| + private boolean checkExpectedTwoMapTypeArguments(TypeArgumentList typeArguments) {
|
| + // has type arguments
|
| + if (typeArguments == null) {
|
| + return false;
|
| + }
|
| + // check number of type arguments
|
| + int num = typeArguments.getArguments().size();
|
| + if (num == 2) {
|
| + return false;
|
| + }
|
| + // report problem
|
| + errorReporter.reportError(
|
| + StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
|
| + typeArguments,
|
| + num);
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| * 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.
|
| *
|
| @@ -2711,6 +2738,32 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * This verifies if the passed list literal has type arguments then there is exactly one.
|
| + *
|
| + * @param node the list literal to evaluate
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see StaticTypeWarningCode#EXPECTED_ONE_LIST_TYPE_ARGUMENTS
|
| + */
|
| + private boolean checkForExpectedOneListTypeArgument(ListLiteral node) {
|
| + // prepare type arguments
|
| + TypeArgumentList typeArguments = node.getTypeArguments();
|
| + if (typeArguments == null) {
|
| + return false;
|
| + }
|
| + // check number of type arguments
|
| + int num = typeArguments.getArguments().size();
|
| + if (num == 1) {
|
| + return false;
|
| + }
|
| + // report problem
|
| + errorReporter.reportError(
|
| + StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS,
|
| + typeArguments,
|
| + num);
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| * This verifies the passed import has unique name among other exported libraries.
|
| *
|
| * @param node the export directive to evaluate
|
|
|