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 RUNTIME_VM_AST_H_ | 5 #ifndef RUNTIME_VM_AST_H_ |
6 #define RUNTIME_VM_AST_H_ | 6 #define RUNTIME_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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); | 278 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); |
279 | 279 |
280 private: | 280 private: |
281 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); | 281 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); |
282 }; | 282 }; |
283 | 283 |
284 | 284 |
285 class ArgumentListNode : public AstNode { | 285 class ArgumentListNode : public AstNode { |
286 public: | 286 public: |
287 explicit ArgumentListNode(TokenPosition token_pos) | 287 explicit ArgumentListNode(TokenPosition token_pos) |
288 : AstNode(token_pos), nodes_(4), names_(Array::ZoneHandle()) {} | 288 : AstNode(token_pos), |
| 289 type_args_var_(NULL), |
| 290 type_arguments_(TypeArguments::ZoneHandle()), |
| 291 type_args_len_(0), |
| 292 nodes_(4), |
| 293 names_(Array::ZoneHandle()) {} |
| 294 |
| 295 ArgumentListNode(TokenPosition token_pos, const TypeArguments& type_arguments) |
| 296 : AstNode(token_pos), |
| 297 type_args_var_(NULL), |
| 298 type_arguments_(type_arguments), |
| 299 type_args_len_(type_arguments.IsNull() ? 0 : type_arguments.Length()), |
| 300 nodes_(4), |
| 301 names_(Array::ZoneHandle()) { |
| 302 ASSERT(type_arguments_.IsZoneHandle()); |
| 303 } |
| 304 |
| 305 ArgumentListNode(TokenPosition token_pos, |
| 306 LocalVariable* type_args_var, |
| 307 intptr_t type_args_len) |
| 308 : AstNode(token_pos), |
| 309 type_args_var_(type_args_var), |
| 310 type_arguments_(TypeArguments::ZoneHandle()), |
| 311 type_args_len_(type_args_len), |
| 312 nodes_(4), |
| 313 names_(Array::ZoneHandle()) { |
| 314 ASSERT((type_args_var_ == NULL) == (type_args_len_ == 0)); |
| 315 } |
289 | 316 |
290 void VisitChildren(AstNodeVisitor* visitor) const; | 317 void VisitChildren(AstNodeVisitor* visitor) const; |
291 | 318 |
| 319 LocalVariable* type_args_var() const { return type_args_var_; } |
| 320 const TypeArguments& type_arguments() const { return type_arguments_; } |
| 321 intptr_t type_args_len() const { return type_args_len_; } |
292 void Add(AstNode* node) { nodes_.Add(node); } | 322 void Add(AstNode* node) { nodes_.Add(node); } |
293 intptr_t length() const { return nodes_.length(); } | 323 intptr_t length() const { return nodes_.length(); } |
294 AstNode* NodeAt(intptr_t index) const { return nodes_[index]; } | 324 AstNode* NodeAt(intptr_t index) const { return nodes_[index]; } |
295 void SetNodeAt(intptr_t index, AstNode* node) { nodes_[index] = node; } | 325 void SetNodeAt(intptr_t index, AstNode* node) { nodes_[index] = node; } |
296 const Array& names() const { return names_; } | 326 const Array& names() const { return names_; } |
297 void set_names(const Array& names) { names_ = names.raw(); } | 327 void set_names(const Array& names) { names_ = names.raw(); } |
298 const GrowableArray<AstNode*>& nodes() const { return nodes_; } | 328 const GrowableArray<AstNode*>& nodes() const { return nodes_; } |
299 | 329 |
300 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode); | 330 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode); |
301 | 331 |
302 private: | 332 private: |
| 333 // At most one of type_args_var_ and type_arguments_ can be set, not both. |
| 334 LocalVariable* type_args_var_; |
| 335 const TypeArguments& type_arguments_; |
| 336 intptr_t type_args_len_; |
303 GrowableArray<AstNode*> nodes_; | 337 GrowableArray<AstNode*> nodes_; |
304 Array& names_; | 338 Array& names_; |
305 | 339 |
306 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); | 340 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); |
307 }; | 341 }; |
308 | 342 |
309 | 343 |
310 class LetNode : public AstNode { | 344 class LetNode : public AstNode { |
311 public: | 345 public: |
312 explicit LetNode(TokenPosition token_pos); | 346 explicit LetNode(TokenPosition token_pos); |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 const intptr_t try_index_; | 2009 const intptr_t try_index_; |
1976 | 2010 |
1977 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 2011 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1978 }; | 2012 }; |
1979 | 2013 |
1980 } // namespace dart | 2014 } // namespace dart |
1981 | 2015 |
1982 #undef DECLARE_COMMON_NODE_FUNCTIONS | 2016 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1983 | 2017 |
1984 #endif // RUNTIME_VM_AST_H_ | 2018 #endif // RUNTIME_VM_AST_H_ |
OLD | NEW |