| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/InstanceState.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/InstanceState.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/InstanceState.java
|
| index 1b5f1bf74e8771ed6ce66709c4326cb104d7f8d7..6e21041afd76d2e4f40138bb9607a83fcffdad5b 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/InstanceState.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/InstanceState.java
|
| @@ -29,7 +29,10 @@ public abstract class InstanceState {
|
| * @return the result of invoking the '+' operator on this object with the given argument
|
| * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| */
|
| - public NumState add(InstanceState rightOperand) throws EvaluationException {
|
| + public InstanceState add(InstanceState rightOperand) throws EvaluationException {
|
| + if (this instanceof StringState || rightOperand instanceof StringState) {
|
| + return concatenate(rightOperand);
|
| + }
|
| assertNumOrNull(this);
|
| assertNumOrNull(rightOperand);
|
| throw new EvaluationException(CompileTimeErrorCode.INVALID_CONSTANT);
|
| @@ -93,6 +96,7 @@ public abstract class InstanceState {
|
| * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| */
|
| public StringState concatenate(InstanceState rightOperand) throws EvaluationException {
|
| + assertString(rightOperand);
|
| throw new EvaluationException(CompileTimeErrorCode.INVALID_CONSTANT);
|
| }
|
|
|
| @@ -364,6 +368,17 @@ public abstract class InstanceState {
|
| }
|
|
|
| /**
|
| + * Return the result of invoking the 'length' getter on this object.
|
| + *
|
| + * @return the result of invoking the 'length' getter on this object
|
| + * @throws EvaluationException if the operator is not appropriate for an object of this kind
|
| + */
|
| + public IntState stringLength() throws EvaluationException {
|
| + assertString(this);
|
| + throw new EvaluationException(CompileTimeErrorCode.INVALID_CONSTANT);
|
| + }
|
| +
|
| + /**
|
| * Return the result of invoking the '*' operator on this object with the given argument.
|
| *
|
| * @param rightOperand the right-hand operand of the operation
|
|
|