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

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

Issue 484933003: Await it! (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 3 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 | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/parser.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_PARSER_H_ 5 #ifndef VM_PARSER_H_
6 #define VM_PARSER_H_ 6 #define VM_PARSER_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 saved_entry_context_var_(NULL), 48 saved_entry_context_var_(NULL),
49 expression_temp_var_(NULL), 49 expression_temp_var_(NULL),
50 finally_return_temp_var_(NULL), 50 finally_return_temp_var_(NULL),
51 await_temps_scope_(NULL), 51 await_temps_scope_(NULL),
52 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), 52 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()),
53 first_parameter_index_(0), 53 first_parameter_index_(0),
54 first_stack_local_index_(0), 54 first_stack_local_index_(0),
55 num_copied_params_(0), 55 num_copied_params_(0),
56 num_stack_locals_(0), 56 num_stack_locals_(0),
57 have_seen_await_expr_(false), 57 have_seen_await_expr_(false),
58 saved_try_ctx_(NULL),
59 async_saved_try_ctx_(NULL),
58 isolate_(isolate) { 60 isolate_(isolate) {
59 ASSERT(function.IsZoneHandle()); 61 ASSERT(function.IsZoneHandle());
60 } 62 }
61 63
62 const Function& function() const { return function_; } 64 const Function& function() const { return function_; }
63 const Code& code() const { return code_; } 65 const Code& code() const { return code_; }
64 66
65 SequenceNode* node_sequence() const { return node_sequence_; } 67 SequenceNode* node_sequence() const { return node_sequence_; }
66 void SetNodeSequence(SequenceNode* node_sequence); 68 void SetNodeSequence(SequenceNode* node_sequence);
67 69
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ASSERT(await_temps_scope_ != NULL); 150 ASSERT(await_temps_scope_ != NULL);
149 return await_temps_scope_; 151 return await_temps_scope_;
150 } 152 }
151 153
152 void record_await() { 154 void record_await() {
153 have_seen_await_expr_ = true; 155 have_seen_await_expr_ = true;
154 } 156 }
155 void reset_have_seen_await() { have_seen_await_expr_ = false; } 157 void reset_have_seen_await() { have_seen_await_expr_ = false; }
156 bool have_seen_await() const { return have_seen_await_expr_; } 158 bool have_seen_await() const { return have_seen_await_expr_; }
157 159
160 void set_saved_try_ctx(LocalVariable* saved_try_ctx) {
161 ASSERT((saved_try_ctx != NULL) && !saved_try_ctx->is_captured());
162 saved_try_ctx_ = saved_try_ctx;
163 }
164 LocalVariable* saved_try_ctx() const { return saved_try_ctx_; }
165
166 void set_async_saved_try_ctx(LocalVariable* async_saved_try_ctx) {
167 ASSERT((async_saved_try_ctx != NULL) && async_saved_try_ctx->is_captured());
168 async_saved_try_ctx_ = async_saved_try_ctx;
169 }
170 LocalVariable* async_saved_try_ctx() const { return async_saved_try_ctx_; }
171
172 void reset_saved_try_ctx_vars() {
173 saved_try_ctx_ = NULL;
174 async_saved_try_ctx_ = NULL;
175 }
176
158 Isolate* isolate() const { return isolate_; } 177 Isolate* isolate() const { return isolate_; }
159 178
160 private: 179 private:
161 const Function& function_; 180 const Function& function_;
162 Code& code_; 181 Code& code_;
163 SequenceNode* node_sequence_; 182 SequenceNode* node_sequence_;
164 LocalVariable* instantiator_; 183 LocalVariable* instantiator_;
165 Array& default_parameter_values_; 184 Array& default_parameter_values_;
166 LocalVariable* saved_current_context_var_; 185 LocalVariable* saved_current_context_var_;
167 LocalVariable* saved_entry_context_var_; 186 LocalVariable* saved_entry_context_var_;
168 LocalVariable* expression_temp_var_; 187 LocalVariable* expression_temp_var_;
169 LocalVariable* finally_return_temp_var_; 188 LocalVariable* finally_return_temp_var_;
170 LocalScope* await_temps_scope_; 189 LocalScope* await_temps_scope_;
171 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; 190 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_;
172 191
173 int first_parameter_index_; 192 int first_parameter_index_;
174 int first_stack_local_index_; 193 int first_stack_local_index_;
175 int num_copied_params_; 194 int num_copied_params_;
176 int num_stack_locals_; 195 int num_stack_locals_;
177 bool have_seen_await_expr_; 196 bool have_seen_await_expr_;
197 LocalVariable* saved_try_ctx_;
198 LocalVariable* async_saved_try_ctx_;
178 199
179 Isolate* isolate_; 200 Isolate* isolate_;
180 201
181 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); 202 DISALLOW_COPY_AND_ASSIGN(ParsedFunction);
182 }; 203 };
183 204
184 205
185 class Parser : public ValueObject { 206 class Parser : public ValueObject {
186 public: 207 public:
187 // Parse the top level of a whole script file and register declared classes 208 // Parse the top level of a whole script file and register declared classes
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); 720 AstNode* MakeAssertCall(intptr_t begin, intptr_t end);
700 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type); 721 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type);
701 AstNode* ThrowNoSuchMethodError(intptr_t call_pos, 722 AstNode* ThrowNoSuchMethodError(intptr_t call_pos,
702 const Class& cls, 723 const Class& cls,
703 const String& function_name, 724 const String& function_name,
704 ArgumentListNode* function_arguments, 725 ArgumentListNode* function_arguments,
705 InvocationMirror::Call call, 726 InvocationMirror::Call call,
706 InvocationMirror::Type type, 727 InvocationMirror::Type type,
707 const Function* func); 728 const Function* func);
708 729
730 void SetupSavedTryContext(LocalScope* saved_try_context_scope,
731 int16_t try_index,
732 SequenceNode* target);
733
709 void CheckOperatorArity(const MemberDesc& member); 734 void CheckOperatorArity(const MemberDesc& member);
710 735
711 void EnsureExpressionTemp(); 736 void EnsureExpressionTemp();
712 void EnsureSavedCurrentContext(); 737 void EnsureSavedCurrentContext();
713 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos); 738 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos);
714 AstNode* CreateAssignmentNode(AstNode* original, 739 AstNode* CreateAssignmentNode(AstNode* original,
715 AstNode* rhs, 740 AstNode* rhs,
716 const String* left_ident, 741 const String* left_ident,
717 intptr_t left_pos); 742 intptr_t left_pos);
718 AstNode* InsertClosureCallNodes(AstNode* condition); 743 AstNode* InsertClosureCallNodes(AstNode* condition);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 int16_t last_used_try_index_; 808 int16_t last_used_try_index_;
784 809
785 bool unregister_pending_function_; 810 bool unregister_pending_function_;
786 811
787 DISALLOW_COPY_AND_ASSIGN(Parser); 812 DISALLOW_COPY_AND_ASSIGN(Parser);
788 }; 813 };
789 814
790 } // namespace dart 815 } // namespace dart
791 816
792 #endif // VM_PARSER_H_ 817 #endif // VM_PARSER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698