Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: runtime/vm/ast.h

Issue 11360116: Pass closure object as first implicit argument to closure functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 const LocalVariable& allocated_object_var_; 1514 const LocalVariable& allocated_object_var_;
1515 1515
1516 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); 1516 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode);
1517 }; 1517 };
1518 1518
1519 1519
1520 // The body of a Dart function marked as 'native' consists of this node. 1520 // The body of a Dart function marked as 'native' consists of this node.
1521 class NativeBodyNode : public AstNode { 1521 class NativeBodyNode : public AstNode {
1522 public: 1522 public:
1523 NativeBodyNode(intptr_t token_pos, 1523 NativeBodyNode(intptr_t token_pos,
1524 const Function& function,
1524 const String& native_c_function_name, 1525 const String& native_c_function_name,
1525 NativeFunction native_c_function, 1526 NativeFunction native_c_function)
1526 int argument_count,
1527 bool has_optional_parameters,
1528 bool is_native_instance_closure)
1529 : AstNode(token_pos), 1527 : AstNode(token_pos),
1528 function_(function),
1530 native_c_function_name_(native_c_function_name), 1529 native_c_function_name_(native_c_function_name),
1531 native_c_function_(native_c_function), 1530 native_c_function_(native_c_function) {
1532 argument_count_(argument_count), 1531 ASSERT(function_.IsZoneHandle());
1533 has_optional_parameters_(has_optional_parameters),
1534 is_native_instance_closure_(is_native_instance_closure) {
1535 ASSERT(native_c_function_ != NULL); 1532 ASSERT(native_c_function_ != NULL);
1536 ASSERT(native_c_function_name_.IsZoneHandle()); 1533 ASSERT(native_c_function_name_.IsZoneHandle());
1537 ASSERT(native_c_function_name_.IsSymbol()); 1534 ASSERT(native_c_function_name_.IsSymbol());
1538 } 1535 }
1539 1536
1537 const Function& function() const { return function_; }
1540 const String& native_c_function_name() const { 1538 const String& native_c_function_name() const {
1541 return native_c_function_name_; 1539 return native_c_function_name_;
1542 } 1540 }
1543 NativeFunction native_c_function() const { return native_c_function_; } 1541 NativeFunction native_c_function() const { return native_c_function_; }
1544 int argument_count() const { return argument_count_; }
1545 bool has_optional_parameters() const {
1546 return has_optional_parameters_;
1547 }
1548 bool is_native_instance_closure() const {
1549 return is_native_instance_closure_;
1550 }
1551 1542
1552 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 1543 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
1553 1544
1554 DECLARE_COMMON_NODE_FUNCTIONS(NativeBodyNode); 1545 DECLARE_COMMON_NODE_FUNCTIONS(NativeBodyNode);
1555 1546
1556 private: 1547 private:
1548 const Function& function_; // Native Dart function.
1557 const String& native_c_function_name_; 1549 const String& native_c_function_name_;
1558 NativeFunction native_c_function_; // Actual non-Dart implementation. 1550 NativeFunction native_c_function_; // Actual non-Dart implementation.
1559 const int argument_count_; // Native Dart function argument count.
1560 const bool has_optional_parameters_; // Native Dart function kind.
1561 const bool is_native_instance_closure_; // An implicit native closure.
1562 1551
1563 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); 1552 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode);
1564 }; 1553 };
1565 1554
1566 1555
1567 class CatchClauseNode : public AstNode { 1556 class CatchClauseNode : public AstNode {
1568 public: 1557 public:
1569 static const int kInvalidTryIndex = -1; 1558 static const int kInvalidTryIndex = -1;
1570 1559
1571 CatchClauseNode(intptr_t token_pos, 1560 CatchClauseNode(intptr_t token_pos,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 const LocalVariable& context_var_; 1703 const LocalVariable& context_var_;
1715 1704
1716 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1705 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1717 }; 1706 };
1718 1707
1719 } // namespace dart 1708 } // namespace dart
1720 1709
1721 #undef DECLARE_COMMON_NODE_FUNCTIONS 1710 #undef DECLARE_COMMON_NODE_FUNCTIONS
1722 1711
1723 #endif // VM_AST_H_ 1712 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698