| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 bool ConditionalExprNode::IsPotentiallyConst() const { | 379 bool ConditionalExprNode::IsPotentiallyConst() const { |
| 380 return this->condition()->IsPotentiallyConst() && | 380 return this->condition()->IsPotentiallyConst() && |
| 381 this->true_expr()->IsPotentiallyConst() && | 381 this->true_expr()->IsPotentiallyConst() && |
| 382 this->false_expr()->IsPotentiallyConst(); | 382 this->false_expr()->IsPotentiallyConst(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 const Instance* ConditionalExprNode::EvalConstExpr() const { | 386 const Instance* ConditionalExprNode::EvalConstExpr() const { |
| 387 const Instance* cond = this->condition()->EvalConstExpr(); | 387 const Instance* cond = this->condition()->EvalConstExpr(); |
| 388 if ((cond != NULL) && | 388 if ((cond != NULL) && |
| 389 cond->IsBool() && |
| 389 (this->true_expr()->EvalConstExpr() != NULL) && | 390 (this->true_expr()->EvalConstExpr() != NULL) && |
| 390 (this->false_expr()->EvalConstExpr() != NULL)) { | 391 (this->false_expr()->EvalConstExpr() != NULL)) { |
| 391 return cond; | 392 return cond; |
| 392 } | 393 } |
| 393 return NULL; | 394 return NULL; |
| 394 } | 395 } |
| 395 | 396 |
| 396 | 397 |
| 397 bool ClosureNode::IsPotentiallyConst() const { | 398 bool ClosureNode::IsPotentiallyConst() const { |
| 398 if (function().IsImplicitStaticClosureFunction()) { | 399 if (function().IsImplicitStaticClosureFunction()) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 if (result.IsError() || result.IsNull()) { | 572 if (result.IsError() || result.IsNull()) { |
| 572 // TODO(turnidge): We could get better error messages by returning | 573 // TODO(turnidge): We could get better error messages by returning |
| 573 // the Error object directly to the parser. This will involve | 574 // the Error object directly to the parser. This will involve |
| 574 // replumbing all of the EvalConstExpr methods. | 575 // replumbing all of the EvalConstExpr methods. |
| 575 return NULL; | 576 return NULL; |
| 576 } | 577 } |
| 577 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 578 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 578 } | 579 } |
| 579 | 580 |
| 580 } // namespace dart | 581 } // namespace dart |
| OLD | NEW |