OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assert.h" | 9 #include "vm/assert.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); | 360 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); |
361 }; | 361 }; |
362 | 362 |
363 | 363 |
364 class ClosureNode : public AstNode { | 364 class ClosureNode : public AstNode { |
365 public: | 365 public: |
366 ClosureNode(intptr_t token_index, const Function& function, LocalScope* scope) | 366 ClosureNode(intptr_t token_index, const Function& function, LocalScope* scope) |
367 : AstNode(token_index), function_(function), scope_(scope) { | 367 : AstNode(token_index), function_(function), scope_(scope) { |
368 ASSERT(function.IsZoneHandle()); | 368 ASSERT(function.IsZoneHandle()); |
| 369 ASSERT(function.IsClosureFunction()); |
| 370 ASSERT(!function.IsImplicitClosureFunction()); |
369 ASSERT(scope_ != NULL); | 371 ASSERT(scope_ != NULL); |
370 } | 372 } |
371 | 373 |
372 const Function& function() const { return function_; } | 374 const Function& function() const { return function_; } |
373 LocalScope* scope() const { return scope_; } | 375 LocalScope* scope() const { return scope_; } |
374 | 376 |
375 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 377 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
376 | 378 |
377 DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode); | 379 DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode); |
378 | 380 |
379 private: | 381 private: |
380 const Function& function_; | 382 const Function& function_; |
381 LocalScope* scope_; | 383 LocalScope* scope_; |
382 | 384 |
383 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); | 385 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); |
384 }; | 386 }; |
385 | 387 |
386 | 388 |
387 class StaticImplicitClosureNode : public AstNode { | 389 class StaticImplicitClosureNode : public AstNode { |
388 public: | 390 public: |
389 StaticImplicitClosureNode(intptr_t token_index, const Function& function) | 391 StaticImplicitClosureNode(intptr_t token_index, const Function& function) |
390 : AstNode(token_index), function_(function) { | 392 : AstNode(token_index), function_(function) { |
391 ASSERT(function.IsZoneHandle()); | 393 ASSERT(function.IsZoneHandle()); |
| 394 ASSERT(function.IsImplicitClosureFunction()); |
| 395 ASSERT(function.is_static()); |
392 } | 396 } |
393 | 397 |
394 const Function& function() const { return function_; } | 398 const Function& function() const { return function_; } |
395 | 399 |
396 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 400 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
397 | 401 |
398 DECLARE_COMMON_NODE_FUNCTIONS(StaticImplicitClosureNode); | 402 DECLARE_COMMON_NODE_FUNCTIONS(StaticImplicitClosureNode); |
399 | 403 |
400 private: | 404 private: |
401 const Function& function_; | 405 const Function& function_; |
402 | 406 |
403 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticImplicitClosureNode); | 407 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticImplicitClosureNode); |
404 }; | 408 }; |
405 | 409 |
406 | 410 |
407 class ImplicitClosureNode : public AstNode { | 411 class ImplicitClosureNode : public AstNode { |
408 public: | 412 public: |
409 ImplicitClosureNode(intptr_t token_index, | 413 ImplicitClosureNode(intptr_t token_index, |
410 const Function& function, | 414 const Function& function, |
411 AstNode* receiver) | 415 AstNode* receiver) |
412 : AstNode(token_index), function_(function), receiver_(receiver) { | 416 : AstNode(token_index), function_(function), receiver_(receiver) { |
413 ASSERT(function.IsZoneHandle()); | 417 ASSERT(function.IsZoneHandle()); |
| 418 ASSERT(function.IsImplicitClosureFunction()); |
| 419 ASSERT(!function.is_static()); |
414 } | 420 } |
415 | 421 |
416 const Function& function() const { return function_; } | 422 const Function& function() const { return function_; } |
417 AstNode* receiver() const { return receiver_; } | 423 AstNode* receiver() const { return receiver_; } |
418 | 424 |
419 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 425 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
420 if (receiver() != NULL) { | 426 if (receiver() != NULL) { |
421 receiver()->Visit(visitor); | 427 receiver()->Visit(visitor); |
422 } | 428 } |
423 } | 429 } |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 const LocalVariable& context_var_; | 1915 const LocalVariable& context_var_; |
1910 | 1916 |
1911 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1917 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1912 }; | 1918 }; |
1913 | 1919 |
1914 } // namespace dart | 1920 } // namespace dart |
1915 | 1921 |
1916 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1922 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1917 | 1923 |
1918 #endif // VM_AST_H_ | 1924 #endif // VM_AST_H_ |
OLD | NEW |