OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_TRANSFORMER_H_ | 5 #ifndef VM_AST_TRANSFORMER_H_ |
6 #define VM_AST_TRANSFORMER_H_ | 6 #define VM_AST_TRANSFORMER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class ParsedFunction; | 13 class ParsedFunction; |
| 14 class Thread; |
14 | 15 |
15 // Translate an AstNode containing an expression (that itself contains one or | 16 // Translate an AstNode containing an expression (that itself contains one or |
16 // more awaits) into a sequential representation where subexpressions are | 17 // more awaits) into a sequential representation where subexpressions are |
17 // evaluated sequentially into intermediates. Those intermediates are stored | 18 // evaluated sequentially into intermediates. Those intermediates are stored |
18 // within a context. | 19 // within a context. |
19 // | 20 // |
20 // This allows a function to be suspended and resumed from within evaluating an | 21 // This allows a function to be suspended and resumed from within evaluating an |
21 // expression. The evaluation is split among a so-called preamble and the | 22 // expression. The evaluation is split among a so-called preamble and the |
22 // evaluation of the resulting expression (which is only a single load). | 23 // evaluation of the resulting expression (which is only a single load). |
23 // | 24 // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 LocalVariable* AddToPreambleNewTempVar(AstNode* node); | 57 LocalVariable* AddToPreambleNewTempVar(AstNode* node); |
57 ArgumentListNode* TransformArguments(ArgumentListNode* node); | 58 ArgumentListNode* TransformArguments(ArgumentListNode* node); |
58 AstNode* LazyTransform(const Token::Kind kind, | 59 AstNode* LazyTransform(const Token::Kind kind, |
59 AstNode* new_left, | 60 AstNode* new_left, |
60 AstNode* right); | 61 AstNode* right); |
61 LocalScope* ChainNewScope(LocalScope* parent); | 62 LocalScope* ChainNewScope(LocalScope* parent); |
62 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); | 63 LocalVariable* GetVariableInScope(LocalScope* scope, const String& symbol); |
63 | 64 |
64 void NextTempVar() { temp_cnt_++; } | 65 void NextTempVar() { temp_cnt_++; } |
65 | 66 |
66 Isolate* isolate() const { return isolate_; } | 67 Thread* thread() const { return thread_; } |
67 | 68 |
68 SequenceNode* preamble_; | 69 SequenceNode* preamble_; |
69 int32_t temp_cnt_; | 70 int32_t temp_cnt_; |
70 AstNode* result_; | 71 AstNode* result_; |
71 ParsedFunction* const parsed_function_; | 72 ParsedFunction* const parsed_function_; |
72 LocalScope* function_top_; | 73 LocalScope* function_top_; |
73 | 74 |
74 Isolate* isolate_; | 75 Thread* thread_; |
75 | 76 |
76 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); | 77 DISALLOW_COPY_AND_ASSIGN(AwaitTransformer); |
77 }; | 78 }; |
78 | 79 |
79 } // namespace dart | 80 } // namespace dart |
80 | 81 |
81 #endif // VM_AST_TRANSFORMER_H_ | 82 #endif // VM_AST_TRANSFORMER_H_ |
OLD | NEW |