Chromium Code Reviews| Index: runtime/vm/ast.cc |
| diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc |
| index 48bd0534e0b425094f3e700caaeeb38ae81486c7..6ce0703e7141d3324c69b5b5dd24acc24e350578 100644 |
| --- a/runtime/vm/ast.cc |
| +++ b/runtime/vm/ast.cc |
| @@ -312,6 +312,7 @@ bool BinaryOpNode::IsPotentiallyConst() const { |
| case Token::kBIT_AND: |
| case Token::kSHL: |
| case Token::kSHR: |
| + case Token::kIFNULL: |
| return this->left()->IsPotentiallyConst() && |
| this->right()->IsPotentiallyConst(); |
| default: |
| @@ -326,7 +327,8 @@ const Instance* BinaryOpNode::EvalConstExpr() const { |
| if (left_val == NULL) { |
| return NULL; |
| } |
| - if (!left_val->IsNumber() && !left_val->IsBool() && !left_val->IsString()) { |
| + if (!left_val->IsNumber() && !left_val->IsBool() && !left_val->IsString() && |
| + kind_ != Token::kIFNULL) { |
| return NULL; |
| } |
| const Instance* right_val = this->right()->EvalConstExpr(); |
| @@ -371,6 +373,9 @@ const Instance* BinaryOpNode::EvalConstExpr() const { |
| return left_val; |
| } |
| return NULL; |
| + case Token::kIFNULL: |
| + if (left_val->IsNull()) return right_val; |
|
Ivan Posva
2015/12/03 21:29:04
{} as is the style elsewhere in this file.
Lasse Reichstein Nielsen
2015/12/04 12:11:46
Done.
|
| + return left_val; |
| default: |
| UNREACHABLE(); |
| return NULL; |