Chromium Code Reviews| Index: src/ast-expression-visitor.h |
| diff --git a/src/ast-expression-visitor.h b/src/ast-expression-visitor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..901f0030f240b6bf6517604b5538be4fb8c26e3c |
| --- /dev/null |
| +++ b/src/ast-expression-visitor.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2015 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef V8_AST_EXPRESSION_VISITOR_H_ |
| +#define V8_AST_EXPRESSION_VISITOR_H_ |
| + |
| +#include "src/allocation.h" |
| +#include "src/ast.h" |
| +#include "src/effects.h" |
| +#include "src/scopes.h" |
| +#include "src/type-info.h" |
| +#include "src/types.h" |
| +#include "src/zone.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| + |
| +// A Visitor over a CompilationInfo's AST that invokes |
| +// VisitExpression on each expression node. |
| + |
| +class AstExpressionVisitor : public AstVisitor { |
| + public: |
| + explicit AstExpressionVisitor(CompilationInfo* info); |
| + |
| + void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
|
titzer
2015/08/19 12:06:37
I don't think you want to define your own new here
bradn
2015/08/20 04:01:40
Not groking. But maybe I'm missing something basic
rossberg
2015/08/20 16:34:26
Honestly, I don't know why typing.h does that. Why
|
| + void operator delete(void* pointer, Zone* zone) {} |
| + void operator delete(void* pointer) {} |
| + |
| + DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| + |
| + protected: |
| + void VisitAll(); |
| + virtual void VisitExpression(Expression* expression) = 0; |
| + int depth() { return depth_; } |
| + |
| + private: |
| + void VisitDeclarations(ZoneList<Declaration*>* d) override; |
| + void VisitStatements(ZoneList<Statement*>* s) override; |
| + |
| +#define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; |
| + AST_NODE_LIST(DECLARE_VISIT) |
| +#undef DECLARE_VISIT |
| + |
| + CompilationInfo* compilation_info_; |
| + int depth_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AstExpressionVisitor); |
| +}; |
| +} |
| +} // namespace v8::internal |
| + |
| +#endif // V8_AST_EXPRESSION_VISITOR_H_ |