| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java
|
| index 131e3312ad59dda122c78cde7614d0d8d4bf3c58..172416fd4176eafb96357c7257cec796fed50ced 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java
|
| @@ -274,12 +274,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl addToValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_NUM;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_NUM;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -312,12 +312,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl bitAndValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeInt() || leftOperand.isSomeInt()) {
|
| - if (isAnyInt() && leftOperand.isAnyInt()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyInt() || !leftOperand.isAnyInt()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_INT);
|
| }
|
| + if (isSomeInt() || leftOperand.isSomeInt()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -342,12 +342,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl bitOrValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeInt() || leftOperand.isSomeInt()) {
|
| - if (isAnyInt() && leftOperand.isAnyInt()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyInt() || !leftOperand.isAnyInt()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_INT);
|
| }
|
| + if (isSomeInt() || leftOperand.isSomeInt()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -372,12 +372,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl bitXorValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeInt() || leftOperand.isSomeInt()) {
|
| - if (isAnyInt() && leftOperand.isAnyInt()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyInt() || !leftOperand.isAnyInt()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_INT);
|
| }
|
| + if (isSomeInt() || leftOperand.isSomeInt()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -416,12 +416,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl divideValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_NUM;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_NUM;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -504,12 +504,12 @@ public class ValidResult extends EvaluationResultImpl {
|
| @Override
|
| protected EvaluationResultImpl greaterThanOrEqualValid(BinaryExpression node,
|
| ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_BOOL;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_BOOL;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -533,12 +533,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl greaterThanValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_BOOL;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_BOOL;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -567,12 +567,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl integerDivideValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -612,12 +612,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl lessThanOrEqualValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_BOOL;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_BOOL;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -641,12 +641,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl lessThanValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_BOOL;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_BOOL;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -675,12 +675,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl logicalAndValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeBool() || leftOperand.isSomeBool()) {
|
| - if (isAnyBool() && leftOperand.isAnyBool()) {
|
| - return RESULT_BOOL;
|
| - }
|
| + if (!isAnyBool() || !leftOperand.isAnyBool()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL);
|
| }
|
| + if (isSomeBool() || leftOperand.isSomeBool()) {
|
| + return RESULT_BOOL;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue instanceof Boolean) {
|
| if (((Boolean) leftValue).booleanValue()) {
|
| @@ -718,12 +718,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl minusValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_NUM;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_NUM;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -793,12 +793,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl remainderValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_NUM;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_NUM;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -831,12 +831,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl shiftLeftValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeInt() || leftOperand.isSomeInt()) {
|
| - if (isAnyInt() && leftOperand.isAnyInt()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyInt() || !leftOperand.isAnyInt()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_INT);
|
| }
|
| + if (isSomeInt() || leftOperand.isSomeInt()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -861,12 +861,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl shiftRightValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeInt() || leftOperand.isSomeInt()) {
|
| - if (isAnyInt() && leftOperand.isAnyInt()) {
|
| - return RESULT_INT;
|
| - }
|
| + if (!isAnyInt() || !leftOperand.isAnyInt()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_INT);
|
| }
|
| + if (isSomeInt() || leftOperand.isSomeInt()) {
|
| + return RESULT_INT;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
| @@ -891,12 +891,12 @@ public class ValidResult extends EvaluationResultImpl {
|
|
|
| @Override
|
| protected EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand) {
|
| - if (isSomeNum() || leftOperand.isSomeNum()) {
|
| - if (isAnyNum() && leftOperand.isAnyNum()) {
|
| - return RESULT_NUM;
|
| - }
|
| + if (!isAnyNum() || !leftOperand.isAnyNum()) {
|
| return error(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
|
| }
|
| + if (isSomeNum() || leftOperand.isSomeNum()) {
|
| + return RESULT_NUM;
|
| + }
|
| Object leftValue = leftOperand.getValue();
|
| if (leftValue == null) {
|
| return error(node.getLeftOperand());
|
|
|