| 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 namespace v8 { | 
|  | 14 namespace internal { | 
|  | 15 | 
|  | 16 class AstLiteralReindexer final : public AstVisitor { | 
|  | 17  public: | 
|  | 18   AstLiteralReindexer() : AstVisitor(), next_index_(0) {} | 
|  | 19 | 
|  | 20   int count() const { return next_index_; } | 
|  | 21   void Reindex(Expression* pattern); | 
|  | 22 | 
|  | 23  private: | 
|  | 24 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) override; | 
|  | 25   AST_NODE_LIST(DEFINE_VISIT) | 
|  | 26 #undef DEFINE_VISIT | 
|  | 27 | 
|  | 28   void VisitStatements(ZoneList<Statement*>* statements) override; | 
|  | 29   void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 
|  | 30   void VisitArguments(ZoneList<Expression*>* arguments); | 
|  | 31   void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | 
|  | 32 | 
|  | 33   void UpdateIndex(MaterializedLiteral* literal) { | 
|  | 34     literal->literal_index_ = next_index_++; | 
|  | 35   } | 
|  | 36 | 
|  | 37   void Visit(AstNode* node) override { node->Accept(this); } | 
|  | 38 | 
|  | 39   int next_index_; | 
|  | 40 | 
|  | 41   DISALLOW_COPY_AND_ASSIGN(AstLiteralReindexer); | 
|  | 42 }; | 
|  | 43 } | 
|  | 44 }  // namespace v8::internal | 
|  | 45 | 
|  | 46 #endif  // V8_AST_LITERAL_REINDEXER | 
| OLD | NEW | 
|---|