| 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 ab69d17a64973804be7a11ba42e7529d41c44aa0..567b5d53eff6af58e2c994d56c36df996b6a29a1 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
|
| @@ -466,6 +466,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
| }
|
| }
|
| + checkForNonConstMapAsExpressionStatement(node);
|
| return super.visitMapLiteral(node);
|
| }
|
|
|
| @@ -1758,6 +1759,32 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * This verifies the passed map literal either:
|
| + * <ul>
|
| + * <li>has {@code const modifier}</li>
|
| + * <li>has explicit type arguments</li>
|
| + * <li>is not expression of the expression statement</li>
|
| + * <ul>
|
| + *
|
| + * @param node the map literal to evaluate
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see CompileTimeErrorCode#NON_CONST_MAP_AS_EXPRESSION_STATEMENT
|
| + */
|
| + private boolean checkForNonConstMapAsExpressionStatement(MapLiteral node) {
|
| + if (node.getModifier() != null) {
|
| + return false;
|
| + }
|
| + if (node.getTypeArguments() != null) {
|
| + return false;
|
| + }
|
| + if (!(node.getParent() instanceof ExpressionStatement)) {
|
| + return false;
|
| + }
|
| + errorReporter.reportError(CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT, node);
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| * This verifies the passed method declaration of operator {@code []=}, has {@code void} return
|
| * type.
|
| *
|
|
|