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 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 }; | 1486 }; |
1487 | 1487 |
1488 | 1488 |
1489 // The body of a Dart function marked as 'native' consists of this node. | 1489 // The body of a Dart function marked as 'native' consists of this node. |
1490 class NativeBodyNode : public AstNode { | 1490 class NativeBodyNode : public AstNode { |
1491 public: | 1491 public: |
1492 NativeBodyNode(intptr_t token_index, | 1492 NativeBodyNode(intptr_t token_index, |
1493 const String& native_c_function_name, | 1493 const String& native_c_function_name, |
1494 NativeFunction native_c_function, | 1494 NativeFunction native_c_function, |
1495 int argument_count, | 1495 int argument_count, |
1496 bool has_optional_parameters) | 1496 bool has_optional_parameters, |
| 1497 bool is_native_instance_closure) |
1497 : AstNode(token_index), | 1498 : AstNode(token_index), |
1498 native_c_function_name_(native_c_function_name), | 1499 native_c_function_name_(native_c_function_name), |
1499 native_c_function_(native_c_function), | 1500 native_c_function_(native_c_function), |
1500 argument_count_(argument_count), | 1501 argument_count_(argument_count), |
1501 has_optional_parameters_(has_optional_parameters) { | 1502 has_optional_parameters_(has_optional_parameters), |
| 1503 is_native_instance_closure_(is_native_instance_closure) { |
1502 ASSERT(native_c_function_ != NULL); | 1504 ASSERT(native_c_function_ != NULL); |
1503 ASSERT(native_c_function_name_.IsZoneHandle()); | 1505 ASSERT(native_c_function_name_.IsZoneHandle()); |
1504 ASSERT(native_c_function_name_.IsSymbol()); | 1506 ASSERT(native_c_function_name_.IsSymbol()); |
1505 } | 1507 } |
1506 | 1508 |
1507 const String& native_c_function_name() const { | 1509 const String& native_c_function_name() const { |
1508 return native_c_function_name_; | 1510 return native_c_function_name_; |
1509 } | 1511 } |
1510 NativeFunction native_c_function() const { return native_c_function_; } | 1512 NativeFunction native_c_function() const { return native_c_function_; } |
1511 int argument_count() const { return argument_count_; } | 1513 int argument_count() const { return argument_count_; } |
1512 bool has_optional_parameters() const { | 1514 bool has_optional_parameters() const { |
1513 return has_optional_parameters_; | 1515 return has_optional_parameters_; |
1514 } | 1516 } |
| 1517 bool is_native_instance_closure() const { |
| 1518 return is_native_instance_closure_; |
| 1519 } |
1515 | 1520 |
1516 virtual void VisitChildren(AstNodeVisitor* visitor) const { } | 1521 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
1517 | 1522 |
1518 DECLARE_COMMON_NODE_FUNCTIONS(NativeBodyNode); | 1523 DECLARE_COMMON_NODE_FUNCTIONS(NativeBodyNode); |
1519 | 1524 |
1520 private: | 1525 private: |
1521 const String& native_c_function_name_; | 1526 const String& native_c_function_name_; |
1522 NativeFunction native_c_function_; // Actual non-Dart implementation. | 1527 NativeFunction native_c_function_; // Actual non-Dart implementation. |
1523 const int argument_count_; // Native Dart function argument count. | 1528 const int argument_count_; // Native Dart function argument count. |
1524 const bool has_optional_parameters_; // Native Dart function kind. | 1529 const bool has_optional_parameters_; // Native Dart function kind. |
| 1530 const bool is_native_instance_closure_; // An implicit native closure. |
1525 | 1531 |
1526 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); | 1532 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); |
1527 }; | 1533 }; |
1528 | 1534 |
1529 | 1535 |
1530 class CatchClauseNode : public AstNode { | 1536 class CatchClauseNode : public AstNode { |
1531 public: | 1537 public: |
1532 static const int kInvalidTryIndex = -1; | 1538 static const int kInvalidTryIndex = -1; |
1533 | 1539 |
1534 CatchClauseNode(intptr_t token_index, | 1540 CatchClauseNode(intptr_t token_index, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 const LocalVariable& context_var_; | 1676 const LocalVariable& context_var_; |
1671 | 1677 |
1672 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1678 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1673 }; | 1679 }; |
1674 | 1680 |
1675 } // namespace dart | 1681 } // namespace dart |
1676 | 1682 |
1677 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1683 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1678 | 1684 |
1679 #endif // VM_AST_H_ | 1685 #endif // VM_AST_H_ |
OLD | NEW |