| Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| index 719a9b20808cc5f957f8dbd84b0c1854d81e7b12..b2bf34ca799263e83b68b599a3ba85874053c6de 100644
|
| --- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| +++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| @@ -347,7 +347,10 @@ public class TypeAnalyzer implements DartCompilationPhase {
|
| return rhs;
|
| }
|
|
|
| - case ASSIGN_ADD:
|
| + case ASSIGN_ADD: {
|
| + checkStringConcatPlus(lhsNode);
|
| + checkStringConcatPlus(rhsNode);
|
| + }
|
| case ASSIGN_SUB:
|
| case ASSIGN_MUL:
|
| case ASSIGN_DIV:
|
| @@ -405,7 +408,10 @@ public class TypeAnalyzer implements DartCompilationPhase {
|
| }
|
| }
|
|
|
| - case ADD:
|
| + case ADD: {
|
| + checkStringConcatPlus(lhsNode);
|
| + checkStringConcatPlus(rhsNode);
|
| + }
|
| case SUB:
|
| case MUL:
|
| case DIV:
|
| @@ -441,6 +447,22 @@ public class TypeAnalyzer implements DartCompilationPhase {
|
| }
|
| }
|
|
|
| + private void checkStringConcatPlus(DartExpression node) {
|
| + if (node != null) {
|
| + Type type = null;
|
| + if (node.getElement() != null) {
|
| + type = node.getElement().getType();
|
| + } else if (node.getType() != null) {
|
| + type = node.getType();
|
| + }
|
| + if (type != null) {
|
| + if (type.equals(stringType)) {
|
| + onError(node, TypeErrorCode.PLUS_CANNOT_BE_USED_FOR_STRING_CONCAT);
|
| + }
|
| + }
|
| + }
|
| + }
|
| +
|
| @Override
|
| public Type visitVariableStatement(DartVariableStatement node) {
|
| Type type = typeOf(node.getTypeNode());
|
|
|