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

Unified Diff: dart/runtime/vm/ast.cc

Issue 60733003: Version 0.8.10.6 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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
Index: dart/runtime/vm/ast.cc
===================================================================
--- dart/runtime/vm/ast.cc (revision 29958)
+++ dart/runtime/vm/ast.cc (working copy)
@@ -255,6 +255,17 @@
bool BinaryOpNode::IsPotentiallyConst() const {
switch (kind_) {
+ case Token::kOR:
+ case Token::kAND:
+ if (this->left()->IsLiteralNode() &&
+ this->left()->AsLiteralNode()->literal().IsNull()) {
+ return false;
+ }
+ if (this->right()->IsLiteralNode() &&
+ this->right()->AsLiteralNode()->literal().IsNull()) {
+ return false;
+ }
+ // Fall-through intentional.
case Token::kADD:
case Token::kSUB:
case Token::kMUL:
@@ -266,8 +277,6 @@
case Token::kBIT_AND:
case Token::kSHL:
case Token::kSHR:
- case Token::kOR:
- case Token::kAND:
return this->left()->IsPotentiallyConst() &&
this->right()->IsPotentiallyConst();
default:
@@ -355,6 +364,10 @@
bool UnaryOpNode::IsPotentiallyConst() const {
+ if (this->operand()->IsLiteralNode() &&
+ this->operand()->AsLiteralNode()->literal().IsNull()) {
+ return false;
+ }
return this->operand()->IsPotentiallyConst();
}

Powered by Google App Engine
This is Rietveld 408576698