| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 double new_value = (dbl.value() == 0.0) ? -0.0 : (0.0 - dbl.value()); | 130 double new_value = (dbl.value() == 0.0) ? -0.0 : (0.0 - dbl.value()); |
| 131 const Double& double_instance = | 131 const Double& double_instance = |
| 132 Double::ZoneHandle(Double::NewCanonical(new_value)); | 132 Double::ZoneHandle(Double::NewCanonical(new_value)); |
| 133 return new LiteralNode(this->token_pos(), double_instance); | 133 return new LiteralNode(this->token_pos(), double_instance); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 return NULL; | 136 return NULL; |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 const char* TypeNode::Name() const { |
| 141 return String::Handle(type().UserVisibleName()).ToCString(); |
| 142 } |
| 143 |
| 144 |
| 140 bool ComparisonNode::IsKindValid() const { | 145 bool ComparisonNode::IsKindValid() const { |
| 141 return Token::IsRelationalOperator(kind_) | 146 return Token::IsRelationalOperator(kind_) |
| 142 || Token::IsEqualityOperator(kind_) | 147 || Token::IsEqualityOperator(kind_) |
| 143 || Token::IsTypeTestOperator(kind_) | 148 || Token::IsTypeTestOperator(kind_) |
| 144 || Token::IsTypeCastOperator(kind_); | 149 || Token::IsTypeCastOperator(kind_); |
| 145 } | 150 } |
| 146 | 151 |
| 147 | 152 |
| 148 const char* ComparisonNode::Name() const { | 153 const char* ComparisonNode::Name() const { |
| 149 return Token::Str(kind_); | 154 return Token::Str(kind_); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 const char* UnaryOpNode::Name() const { | 403 const char* UnaryOpNode::Name() const { |
| 399 return Token::Str(kind_); | 404 return Token::Str(kind_); |
| 400 } | 405 } |
| 401 | 406 |
| 402 | 407 |
| 403 const char* JumpNode::Name() const { | 408 const char* JumpNode::Name() const { |
| 404 return Token::Str(kind_); | 409 return Token::Str(kind_); |
| 405 } | 410 } |
| 406 | 411 |
| 407 | 412 |
| 413 const char* LoadLocalNode::Name() const { |
| 414 return local().name().ToCString(); |
| 415 } |
| 416 |
| 417 |
| 408 bool LoadLocalNode::IsPotentiallyConst() const { | 418 bool LoadLocalNode::IsPotentiallyConst() const { |
| 409 // Parameters of const constructors are implicitly final and can be | 419 // Parameters of const constructors are implicitly final and can be |
| 410 // used in initializer expressions. | 420 // used in initializer expressions. |
| 411 // We can't check here whether the local variable is indeed a parameter, | 421 // We can't check here whether the local variable is indeed a parameter, |
| 412 // but this code is executed before any other local variables are | 422 // but this code is executed before any other local variables are |
| 413 // added to the scope. | 423 // added to the scope. |
| 414 return local().is_final(); | 424 return local().is_final(); |
| 415 } | 425 } |
| 416 | 426 |
| 417 | 427 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 if (result.IsError() || result.IsNull()) { | 550 if (result.IsError() || result.IsNull()) { |
| 541 // TODO(turnidge): We could get better error messages by returning | 551 // TODO(turnidge): We could get better error messages by returning |
| 542 // the Error object directly to the parser. This will involve | 552 // the Error object directly to the parser. This will involve |
| 543 // replumbing all of the EvalConstExpr methods. | 553 // replumbing all of the EvalConstExpr methods. |
| 544 return NULL; | 554 return NULL; |
| 545 } | 555 } |
| 546 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 556 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 547 } | 557 } |
| 548 | 558 |
| 549 } // namespace dart | 559 } // namespace dart |
| OLD | NEW |