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

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

Issue 10350003: Step toward eliminating increment nodes, starting with increment local. Fix a bug in evaluating sid… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months 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.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"
11 #include "vm/scopes.h" 11 #include "vm/scopes.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/native_entry.h" 13 #include "vm/native_entry.h"
14 #include "vm/token.h" 14 #include "vm/token.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 #define NODE_LIST(V) \ 18 #define NODE_LIST(V) \
19 V(ReturnNode, "return") \ 19 V(ReturnNode, "return") \
20 V(LiteralNode, "literal") \ 20 V(LiteralNode, "literal") \
21 V(TypeNode, "type") \ 21 V(TypeNode, "type") \
22 V(AssignableNode, "assignable") \ 22 V(AssignableNode, "assignable") \
23 V(BinaryOpNode, "binop") \ 23 V(BinaryOpNode, "binop") \
24 V(StringConcatNode, "concat") \ 24 V(StringConcatNode, "concat") \
25 V(ComparisonNode, "compare") \ 25 V(ComparisonNode, "compare") \
26 V(UnaryOpNode, "unaryop") \ 26 V(UnaryOpNode, "unaryop") \
27 V(IncrOpLocalNode, "incr local") \
28 V(IncrOpInstanceFieldNode, "incr instance field") \ 27 V(IncrOpInstanceFieldNode, "incr instance field") \
29 V(IncrOpIndexedNode, "incr indexed") \ 28 V(IncrOpIndexedNode, "incr indexed") \
30 V(ConditionalExprNode, "?:") \ 29 V(ConditionalExprNode, "?:") \
31 V(IfNode, "if") \ 30 V(IfNode, "if") \
32 V(SwitchNode, "switch") \ 31 V(SwitchNode, "switch") \
33 V(CaseNode, "case") \ 32 V(CaseNode, "case") \
34 V(WhileNode, "while") \ 33 V(WhileNode, "while") \
35 V(DoWhileNode, "dowhile") \ 34 V(DoWhileNode, "dowhile") \
36 V(ForNode, "for") \ 35 V(ForNode, "for") \
37 V(JumpNode, "jump") \ 36 V(JumpNode, "jump") \
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 private: 654 private:
656 const Token::Kind kind_; 655 const Token::Kind kind_;
657 AstNode* operand_; 656 AstNode* operand_;
658 657
659 bool IsKindValid() const; 658 bool IsKindValid() const;
660 659
661 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode); 660 DISALLOW_IMPLICIT_CONSTRUCTORS(UnaryOpNode);
662 }; 661 };
663 662
664 663
665 class IncrOpLocalNode : public AstNode {
666 public:
667 IncrOpLocalNode(intptr_t token_index,
668 Token::Kind kind,
669 bool prefix,
670 const LocalVariable& local)
671 : AstNode(token_index), kind_(kind), prefix_(prefix), local_(local) {
672 ASSERT(kind_ == Token::kINCR || kind_ == Token::kDECR);
673 }
674
675 Token::Kind kind() const { return kind_; }
676 bool prefix() const { return prefix_; }
677 const LocalVariable& local() const { return local_; }
678
679 virtual void VisitChildren(AstNodeVisitor* visitor) const {}
680
681 virtual const char* Name() const;
682
683 DECLARE_COMMON_NODE_FUNCTIONS(IncrOpLocalNode);
684
685 private:
686 const Token::Kind kind_;
687 const bool prefix_;
688 const LocalVariable& local_;
689
690 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrOpLocalNode);
691 };
692
693
694 class IncrOpInstanceFieldNode : public AstNode { 664 class IncrOpInstanceFieldNode : public AstNode {
695 public: 665 public:
696 IncrOpInstanceFieldNode(intptr_t token_index, 666 IncrOpInstanceFieldNode(intptr_t token_index,
697 Token::Kind kind, 667 Token::Kind kind,
698 bool prefix, 668 bool prefix,
699 AstNode* receiver, 669 AstNode* receiver,
700 const String& field_name) 670 const String& field_name)
701 : AstNode(token_index), 671 : AstNode(token_index),
702 kind_(kind), 672 kind_(kind),
703 prefix_(prefix), 673 prefix_(prefix),
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 const LocalVariable& context_var_; 1857 const LocalVariable& context_var_;
1888 1858
1889 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1859 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1890 }; 1860 };
1891 1861
1892 } // namespace dart 1862 } // namespace dart
1893 1863
1894 #undef DECLARE_COMMON_NODE_FUNCTIONS 1864 #undef DECLARE_COMMON_NODE_FUNCTIONS
1895 1865
1896 #endif // VM_AST_H_ 1866 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698