OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_AST_LITERAL_REINDEXER | |
6 #define V8_AST_LITERAL_REINDEXER | |
7 | |
8 #include "src/v8.h" | |
9 | |
10 #include "src/ast.h" | |
11 #include "src/scopes.h" | |
12 | |
13 #include "src/prettyprinter.h" | |
adamk
2015/06/26 15:06:37
I don't think you need this include, maybe you wer
Dmitry Lomov (no reviews)
2015/06/26 21:13:13
Done.
| |
14 | |
15 namespace v8 { | |
16 namespace internal { | |
17 | |
18 class AstLiteralReindexer final : public AstVisitor { | |
19 public: | |
20 AstLiteralReindexer() : AstVisitor(), next_index_(0) {} | |
21 | |
22 int count() const { return next_index_; } | |
23 void Reindex(Expression* pattern); | |
24 | |
25 private: | |
26 int next_index_; | |
adamk
2015/06/26 15:06:37
Nit: member variables should come after methods.
Dmitry Lomov (no reviews)
2015/06/26 21:13:13
Done.
| |
27 | |
28 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) override; | |
29 AST_NODE_LIST(DEFINE_VISIT) | |
30 #undef DEFINE_VISIT | |
31 | |
32 void VisitStatements(ZoneList<Statement*>* statements) override; | |
33 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | |
34 void VisitArguments(ZoneList<Expression*>* arguments); | |
35 void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | |
36 | |
37 void UpdateIndex(MaterializedLiteral* literal) { | |
38 literal->literal_index_ = next_index_++; | |
39 } | |
40 | |
41 void Visit(AstNode* node) override { node->Accept(this); } | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(AstLiteralReindexer); | |
44 }; | |
45 } | |
46 } // namespace v8::internal | |
47 | |
48 #endif // V8_AST_LITERAL_REINDEXER | |
OLD | NEW |