| OLD | NEW |
| 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 Token::Kind kind_; | 1157 Token::Kind kind_; |
| 1158 SourceLabel* label_; | 1158 SourceLabel* label_; |
| 1159 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; | 1159 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; |
| 1160 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); | 1160 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); |
| 1161 }; | 1161 }; |
| 1162 | 1162 |
| 1163 | 1163 |
| 1164 class LoadLocalNode : public AstNode { | 1164 class LoadLocalNode : public AstNode { |
| 1165 public: | 1165 public: |
| 1166 LoadLocalNode(intptr_t token_index, const LocalVariable& local) | 1166 LoadLocalNode(intptr_t token_index, const LocalVariable& local) |
| 1167 : AstNode(token_index), local_(local) { } | 1167 : AstNode(token_index), local_(local), pseudo_(NULL) { } |
| 1168 // The pseudo node does not produce input but must be visited before |
| 1169 // completing local load. |
| 1170 LoadLocalNode(intptr_t token_index, |
| 1171 const LocalVariable& local, |
| 1172 AstNode* pseudo) |
| 1173 : AstNode(token_index), local_(local), pseudo_(pseudo) {} |
| 1168 | 1174 |
| 1169 const LocalVariable& local() const { return local_; } | 1175 const LocalVariable& local() const { return local_; } |
| 1176 AstNode* pseudo() const { return pseudo_; } // Can be NULL. |
| 1177 bool HasPseudo() const { return pseudo_ != NULL; } |
| 1170 | 1178 |
| 1171 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1179 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1180 if (HasPseudo()) { |
| 1181 pseudo()->Visit(visitor); |
| 1182 } |
| 1183 } |
| 1172 | 1184 |
| 1173 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1185 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
| 1174 | 1186 |
| 1175 virtual AstNode* MakeIncrOpNode(intptr_t token_index, | 1187 virtual AstNode* MakeIncrOpNode(intptr_t token_index, |
| 1176 Token::Kind kind, | 1188 Token::Kind kind, |
| 1177 bool is_prefix); | 1189 bool is_prefix); |
| 1178 | 1190 |
| 1179 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); | 1191 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); |
| 1180 | 1192 |
| 1181 private: | 1193 private: |
| 1182 const LocalVariable& local_; | 1194 const LocalVariable& local_; |
| 1195 AstNode* pseudo_; |
| 1183 | 1196 |
| 1184 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); | 1197 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); |
| 1185 }; | 1198 }; |
| 1186 | 1199 |
| 1187 | 1200 |
| 1188 class StoreLocalNode : public AstNode { | 1201 class StoreLocalNode : public AstNode { |
| 1189 public: | 1202 public: |
| 1190 StoreLocalNode(intptr_t token_index, | 1203 StoreLocalNode(intptr_t token_index, |
| 1191 const LocalVariable& local, | 1204 const LocalVariable& local, |
| 1192 AstNode* value) | 1205 AstNode* value) |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 const LocalVariable& context_var_; | 1887 const LocalVariable& context_var_; |
| 1875 | 1888 |
| 1876 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1889 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1877 }; | 1890 }; |
| 1878 | 1891 |
| 1879 } // namespace dart | 1892 } // namespace dart |
| 1880 | 1893 |
| 1881 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1894 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1882 | 1895 |
| 1883 #endif // VM_AST_H_ | 1896 #endif // VM_AST_H_ |
| OLD | NEW |