| 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/log.h" | 9 #include "vm/log.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 void ArgumentListNode::VisitChildren(AstNodeVisitor* visitor) const { | 87 void ArgumentListNode::VisitChildren(AstNodeVisitor* visitor) const { |
| 88 for (intptr_t i = 0; i < this->length(); i++) { | 88 for (intptr_t i = 0; i < this->length(); i++) { |
| 89 NodeAt(i)->Visit(visitor); | 89 NodeAt(i)->Visit(visitor); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 LetNode::LetNode(intptr_t token_pos) | 94 LetNode::LetNode(TokenDescriptor token_pos) |
| 95 : AstNode(token_pos), | 95 : AstNode(token_pos), |
| 96 vars_(1), | 96 vars_(1), |
| 97 initializers_(1), | 97 initializers_(1), |
| 98 nodes_(1) { } | 98 nodes_(1) { } |
| 99 | 99 |
| 100 | 100 |
| 101 LocalVariable* LetNode::AddInitializer(AstNode* node) { | 101 LocalVariable* LetNode::AddInitializer(AstNode* node) { |
| 102 initializers_.Add(node); | 102 initializers_.Add(node); |
| 103 char name[64]; | 103 char name[64]; |
| 104 OS::SNPrint(name, sizeof(name), ":lt%" Pd "_%" Pd "", | 104 OS::SNPrint(name, sizeof(name), ":lt%" Pd "_%" Pd "", |
| 105 token_pos(), vars_.length()); | 105 token_pos().value(), vars_.length()); |
| 106 LocalVariable* temp_var = | 106 LocalVariable* temp_var = |
| 107 new LocalVariable(token_pos(), | 107 new LocalVariable(token_pos(), |
| 108 String::ZoneHandle(Symbols::New(name)), | 108 String::ZoneHandle(Symbols::New(name)), |
| 109 Object::dynamic_type()); | 109 Object::dynamic_type()); |
| 110 vars_.Add(temp_var); | 110 vars_.Add(temp_var); |
| 111 return temp_var; | 111 return temp_var; |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 void LetNode::VisitChildren(AstNodeVisitor* visitor) const { | 115 void LetNode::VisitChildren(AstNodeVisitor* visitor) const { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 return left_val; | 427 return left_val; |
| 428 default: | 428 default: |
| 429 UNREACHABLE(); | 429 UNREACHABLE(); |
| 430 return NULL; | 430 return NULL; |
| 431 } | 431 } |
| 432 return NULL; | 432 return NULL; |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 AstNode* UnaryOpNode::UnaryOpOrLiteral(intptr_t token_pos, | 436 AstNode* UnaryOpNode::UnaryOpOrLiteral(TokenDescriptor token_pos, |
| 437 Token::Kind kind, | 437 Token::Kind kind, |
| 438 AstNode* operand) { | 438 AstNode* operand) { |
| 439 AstNode* new_operand = operand->ApplyUnaryOp(kind); | 439 AstNode* new_operand = operand->ApplyUnaryOp(kind); |
| 440 if (new_operand != NULL) { | 440 if (new_operand != NULL) { |
| 441 return new_operand; | 441 return new_operand; |
| 442 } | 442 } |
| 443 return new UnaryOpNode(token_pos, kind, operand); | 443 return new UnaryOpNode(token_pos, kind, operand); |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 if (result.IsError() || result.IsNull()) { | 817 if (result.IsError() || result.IsNull()) { |
| 818 // TODO(turnidge): We could get better error messages by returning | 818 // TODO(turnidge): We could get better error messages by returning |
| 819 // the Error object directly to the parser. This will involve | 819 // the Error object directly to the parser. This will involve |
| 820 // replumbing all of the EvalConstExpr methods. | 820 // replumbing all of the EvalConstExpr methods. |
| 821 return NULL; | 821 return NULL; |
| 822 } | 822 } |
| 823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); | 823 return &Instance::ZoneHandle(Instance::Cast(result).raw()); |
| 824 } | 824 } |
| 825 | 825 |
| 826 } // namespace dart | 826 } // namespace dart |
| OLD | NEW |