Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: runtime/vm/ast.h

Issue 460763002: Fix returning from async functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 const Object& primary_; 511 const Object& primary_;
512 bool is_deferred_reference_; 512 bool is_deferred_reference_;
513 513
514 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); 514 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode);
515 }; 515 };
516 516
517 517
518 class ReturnNode : public AstNode { 518 class ReturnNode : public AstNode {
519 public: 519 public:
520 // Return from a void function returns the null object. 520 // Return from a void function returns the null object.
521 explicit ReturnNode(intptr_t token_pos) 521 explicit ReturnNode(intptr_t token_pos, LocalScope* return_scope)
hausner 2014/08/12 20:03:56 I appreciate your attempt to use a long name, but
Michael Lippautz (Google) 2014/08/12 20:32:12 Done.
522 : AstNode(token_pos), 522 : AstNode(token_pos),
523 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), 523 value_(new LiteralNode(token_pos, Instance::ZoneHandle())),
524 inlined_finally_list_(), 524 inlined_finally_list_(),
525 saved_return_value_var_(NULL) { } 525 saved_return_value_var_(NULL),
526 return_scope_(return_scope) { }
526 // Return from a non-void function. 527 // Return from a non-void function.
527 ReturnNode(intptr_t token_pos, 528 ReturnNode(intptr_t token_pos,
528 AstNode* value) 529 AstNode* value,
530 LocalScope* return_scope)
529 : AstNode(token_pos), 531 : AstNode(token_pos),
530 value_(value), 532 value_(value),
531 inlined_finally_list_(), 533 inlined_finally_list_(),
532 saved_return_value_var_(NULL) { 534 saved_return_value_var_(NULL),
535 return_scope_(return_scope) {
533 ASSERT(value_ != NULL); 536 ASSERT(value_ != NULL);
534 } 537 }
535 538
536 AstNode* value() const { return value_; } 539 AstNode* value() const { return value_; }
537 540
538 intptr_t inlined_finally_list_length() const { 541 intptr_t inlined_finally_list_length() const {
539 return inlined_finally_list_.length(); 542 return inlined_finally_list_.length();
540 } 543 }
541 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { 544 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const {
542 return inlined_finally_list_[index]; 545 return inlined_finally_list_[index];
543 } 546 }
544 void AddInlinedFinallyNode(InlinedFinallyNode* finally_node) { 547 void AddInlinedFinallyNode(InlinedFinallyNode* finally_node) {
545 inlined_finally_list_.Add(finally_node); 548 inlined_finally_list_.Add(finally_node);
546 } 549 }
547 550
548 LocalVariable* saved_return_value_var() const { 551 LocalVariable* saved_return_value_var() const {
549 return saved_return_value_var_; 552 return saved_return_value_var_;
550 } 553 }
551 void set_saved_return_value_var(LocalVariable* var) { 554 void set_saved_return_value_var(LocalVariable* var) {
552 saved_return_value_var_ = var; 555 saved_return_value_var_ = var;
553 } 556 }
554 557
555 virtual void VisitChildren(AstNodeVisitor* visitor) const { 558 virtual void VisitChildren(AstNodeVisitor* visitor) const {
556 if (value() != NULL) { 559 if (value() != NULL) {
557 value()->Visit(visitor); 560 value()->Visit(visitor);
558 } 561 }
559 } 562 }
560 563
564 LocalScope* return_scope() const { return return_scope_; }
565
561 DECLARE_COMMON_NODE_FUNCTIONS(ReturnNode); 566 DECLARE_COMMON_NODE_FUNCTIONS(ReturnNode);
562 567
563 private: 568 private:
564 AstNode* value_; 569 AstNode* value_;
565 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; 570 GrowableArray<InlinedFinallyNode*> inlined_finally_list_;
566 LocalVariable* saved_return_value_var_; 571 LocalVariable* saved_return_value_var_;
572 LocalScope* return_scope_;
567 573
568 DISALLOW_COPY_AND_ASSIGN(ReturnNode); 574 DISALLOW_COPY_AND_ASSIGN(ReturnNode);
569 }; 575 };
570 576
571 577
572 class ComparisonNode : public AstNode { 578 class ComparisonNode : public AstNode {
573 public: 579 public:
574 ComparisonNode(intptr_t token_pos, 580 ComparisonNode(intptr_t token_pos,
575 Token::Kind kind, 581 Token::Kind kind,
576 AstNode* left, 582 AstNode* left,
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 const intptr_t try_index_; 1810 const intptr_t try_index_;
1805 1811
1806 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1812 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1807 }; 1813 };
1808 1814
1809 } // namespace dart 1815 } // namespace dart
1810 1816
1811 #undef DECLARE_COMMON_NODE_FUNCTIONS 1817 #undef DECLARE_COMMON_NODE_FUNCTIONS
1812 1818
1813 #endif // VM_AST_H_ 1819 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698