Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/ast.h" | 5 #include "vm/ast.h" |
| 6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/resolver.h" | 10 #include "vm/resolver.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 case Token::kGT: | 222 case Token::kGT: |
| 223 case Token::kLTE: | 223 case Token::kLTE: |
| 224 case Token::kGTE: | 224 case Token::kGTE: |
| 225 if ((left_val->IsNumber() || left_val->IsNull()) && | 225 if ((left_val->IsNumber() || left_val->IsNull()) && |
| 226 (right_val->IsNumber() || right_val->IsNull())) { | 226 (right_val->IsNumber() || right_val->IsNull())) { |
| 227 return &Bool::False(); | 227 return &Bool::False(); |
| 228 } | 228 } |
| 229 return NULL; | 229 return NULL; |
| 230 case Token::kEQ: | 230 case Token::kEQ: |
| 231 case Token::kNE: | 231 case Token::kNE: |
| 232 case Token::kEQ_STRICT: | |
| 233 case Token::kNE_STRICT: | |
| 234 // The comparison is a compile time const if both operands are either a | 232 // The comparison is a compile time const if both operands are either a |
| 235 // number, string, or boolean value (but not necessarily the same type). | 233 // number, string, or boolean value (but not necessarily the same type). |
| 236 if ((left_val->IsNumber() || | 234 if ((left_val->IsNumber() || |
| 237 left_val->IsString() || | 235 left_val->IsString() || |
| 238 left_val->IsBool() || | 236 left_val->IsBool() || |
| 239 left_val->IsNull()) && | 237 left_val->IsNull()) && |
| 240 (right_val->IsNumber() || | 238 (right_val->IsNumber() || |
| 241 right_val->IsString() || | 239 right_val->IsString() || |
| 242 right_val->IsBool() || | 240 right_val->IsBool() || |
| 243 right_val->IsNull())) { | 241 right_val->IsNull())) { |
| 244 return &Bool::False(); | 242 return &Bool::False(); |
| 245 } | 243 } |
| 246 return NULL; | 244 return NULL; |
| 245 case Token::kEQ_STRICT: | |
| 246 case Token::kNE_STRICT: | |
|
hausner
2015/07/28 18:01:58
// identical(a, b) is a compile time const if both
srdjan
2015/07/28 18:36:08
Done.
| |
| 247 return &Bool::True(); | |
| 247 default: | 248 default: |
| 248 return NULL; | 249 return NULL; |
| 249 } | 250 } |
| 250 return NULL; | 251 return NULL; |
| 251 } | 252 } |
| 252 | 253 |
| 253 | 254 |
| 254 | 255 |
| 255 bool BinaryOpNode::IsKindValid() const { | 256 bool BinaryOpNode::IsKindValid() const { |
| 256 switch (kind_) { | 257 switch (kind_) { |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 if (result.IsError() || result.IsNull()) { | 750 if (result.IsError() || result.IsNull()) { |
| 750 // TODO(turnidge): We could get better error messages by returning | 751 // TODO(turnidge): We could get better error messages by returning |
| 751 // the Error object directly to the parser. This will involve | 752 // the Error object directly to the parser. This will involve |
| 752 // replumbing all of the EvalConstExpr methods. | 753 // replumbing all of the EvalConstExpr methods. |
| 753 return NULL; | 754 return NULL; |
| 754 } | 755 } |
| 755 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 756 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 756 } | 757 } |
| 757 | 758 |
| 758 } // namespace dart | 759 } // namespace dart |
| OLD | NEW |