Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/constant/ValidResult.java

Issue 17583005: Report CONST_EVAL_TYPE_BOOL when left operand of || is 'true'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f83a201cce3429de184ae437319be05f67946aec..97f66ffe37fe906a74af758673c3b32ebeb9c7cd 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
@@ -699,12 +699,12 @@ public class ValidResult extends EvaluationResultImpl {
@Override
protected EvaluationResultImpl logicalOrValid(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 && ((Boolean) leftValue).booleanValue()) {
return RESULT_TRUE;
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698