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

Unified Diff: runtime/vm/ast.cc

Issue 9969023: Fix two compile time const issues (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.cc
===================================================================
--- runtime/vm/ast.cc (revision 6048)
+++ runtime/vm/ast.cc (working copy)
@@ -138,9 +138,14 @@
case Token::kNE:
case Token::kEQ_STRICT:
case Token::kNE_STRICT:
- if ((left_val->IsNumber() && right_val->IsNumber()) ||
- (left_val->IsString() && right_val->IsString()) ||
- (left_val->IsBool() && right_val->IsBool())) {
+ // The comparison is a compile time const if both operands are either a
+ // number, string, or boolean value (but not necessarily the same type).
+ if ((left_val->IsNumber() ||
+ left_val->IsString() ||
+ left_val->IsBool()) &&
+ (right_val->IsNumber() ||
+ right_val->IsString() ||
+ right_val->IsBool())) {
return &Bool::ZoneHandle(Bool::False());
}
return NULL;
@@ -209,6 +214,7 @@
case Token::kMUL:
case Token::kDIV:
case Token::kMOD:
+ case Token::kTRUNCDIV:
if (left_val->IsInteger()) {
if (right_val->IsInteger()) {
return left_val;
@@ -220,7 +226,6 @@
return left_val;
}
return NULL;
- case Token::kTRUNCDIV:
case Token::kBIT_OR:
case Token::kBIT_XOR:
case Token::kBIT_AND:
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698