OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_AST_EXPRESSION_REWRITER_H_ | 5 #ifndef V8_AST_AST_EXPRESSION_REWRITER_H_ |
6 #define V8_AST_AST_EXPRESSION_REWRITER_H_ | 6 #define V8_AST_AST_EXPRESSION_REWRITER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
11 #include "src/type-info.h" | 11 #include "src/type-info.h" |
12 #include "src/zone.h" | 12 #include "src/zone.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // A rewriting Visitor over a CompilationInfo's AST that invokes | 17 // A rewriting Visitor over a CompilationInfo's AST that invokes |
18 // VisitExpression on each expression node. | 18 // VisitExpression on each expression node. |
19 | 19 |
20 class AstExpressionRewriter : public AstVisitor { | 20 class AstExpressionRewriter : public AstVisitor<AstExpressionRewriter> { |
Igor Sheludko
2016/07/14 16:39:54
Same here.
Toon Verwaest
2016/07/15 07:07:19
Done.
| |
21 public: | 21 public: |
22 explicit AstExpressionRewriter(Isolate* isolate) : AstVisitor() { | 22 explicit AstExpressionRewriter(Isolate* isolate) { |
23 InitializeAstRewriter(isolate); | 23 InitializeAstRewriter(isolate); |
24 } | 24 } |
25 explicit AstExpressionRewriter(uintptr_t stack_limit) : AstVisitor() { | 25 explicit AstExpressionRewriter(uintptr_t stack_limit) { |
26 InitializeAstRewriter(stack_limit); | 26 InitializeAstRewriter(stack_limit); |
27 } | 27 } |
28 ~AstExpressionRewriter() override {} | 28 virtual ~AstExpressionRewriter() {} |
29 | 29 |
30 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 30 virtual void VisitDeclarations(ZoneList<Declaration*>* declarations); |
31 void VisitStatements(ZoneList<Statement*>* statements) override; | 31 virtual void VisitStatements(ZoneList<Statement*>* statements); |
32 void VisitExpressions(ZoneList<Expression*>* expressions) override; | 32 virtual void VisitExpressions(ZoneList<Expression*>* expressions); |
33 | 33 |
34 virtual void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | 34 virtual void VisitObjectLiteralProperty(ObjectLiteralProperty* property); |
35 | 35 |
36 protected: | 36 protected: |
37 virtual bool RewriteExpression(Expression* expr) = 0; | 37 virtual bool RewriteExpression(Expression* expr) = 0; |
38 | 38 |
39 private: | 39 private: |
40 DEFINE_AST_REWRITER_SUBCLASS_MEMBERS(); | 40 DEFINE_AST_REWRITER_SUBCLASS_MEMBERS(); |
41 | 41 |
42 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 42 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
43 AST_NODE_LIST(DECLARE_VISIT) | 43 AST_NODE_LIST(DECLARE_VISIT) |
44 #undef DECLARE_VISIT | 44 #undef DECLARE_VISIT |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(AstExpressionRewriter); | 46 DISALLOW_COPY_AND_ASSIGN(AstExpressionRewriter); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace internal | 49 } // namespace internal |
50 } // namespace v8 | 50 } // namespace v8 |
51 | 51 |
52 #endif // V8_AST_AST_EXPRESSION_REWRITER_H_ | 52 #endif // V8_AST_AST_EXPRESSION_REWRITER_H_ |
OLD | NEW |