| 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_LITERAL_REINDEXER | 5 #ifndef V8_AST_AST_LITERAL_REINDEXER | 
| 6 #define V8_AST_AST_LITERAL_REINDEXER | 6 #define V8_AST_AST_LITERAL_REINDEXER | 
| 7 | 7 | 
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" | 
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" | 
| 10 | 10 | 
| 11 namespace v8 { | 11 namespace v8 { | 
| 12 namespace internal { | 12 namespace internal { | 
| 13 | 13 | 
| 14 class AstLiteralReindexer final : public AstVisitor<AstLiteralReindexer> { | 14 class AstLiteralReindexer final : public AstVisitor<AstLiteralReindexer> { | 
| 15  public: | 15  public: | 
| 16   AstLiteralReindexer() : next_index_(0) {} | 16   AstLiteralReindexer() : next_index_(0) {} | 
| 17 | 17 | 
| 18   int count() const { return next_index_; } | 18   int count() const { return next_index_; } | 
| 19   void Reindex(Expression* pattern); | 19   void Reindex(Expression* pattern); | 
| 20 | 20 | 
| 21  private: | 21  private: | 
| 22 #define DEFINE_VISIT(type) void Visit##type(type* node); | 22 #define DEFINE_VISIT(type) void Visit##type(type* node); | 
| 23   AST_NODE_LIST(DEFINE_VISIT) | 23   AST_NODE_LIST(DEFINE_VISIT) | 
| 24 #undef DEFINE_VISIT | 24 #undef DEFINE_VISIT | 
| 25 | 25 | 
| 26   void VisitStatements(ZoneList<Statement*>* statements); | 26   void VisitStatements(ZoneList<Statement*>* statements); | 
| 27   void VisitDeclarations(ZoneList<Declaration*>* declarations); | 27   void VisitDeclarations(ZoneList<Declaration*>* declarations); | 
| 28   void VisitArguments(ZoneList<Expression*>* arguments); | 28   void VisitArguments(ZoneList<Expression*>* arguments); | 
| 29   void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | 29   void VisitLiteralProperty(LiteralProperty* property); | 
| 30 | 30 | 
| 31   void UpdateIndex(MaterializedLiteral* literal) { | 31   void UpdateIndex(MaterializedLiteral* literal) { | 
| 32     literal->literal_index_ = next_index_++; | 32     literal->literal_index_ = next_index_++; | 
| 33   } | 33   } | 
| 34 | 34 | 
| 35   int next_index_; | 35   int next_index_; | 
| 36 | 36 | 
| 37   DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 37   DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() | 
| 38   DISALLOW_COPY_AND_ASSIGN(AstLiteralReindexer); | 38   DISALLOW_COPY_AND_ASSIGN(AstLiteralReindexer); | 
| 39 }; | 39 }; | 
| 40 }  // namespace internal | 40 }  // namespace internal | 
| 41 }  // namespace v8 | 41 }  // namespace v8 | 
| 42 | 42 | 
| 43 #endif  // V8_AST_AST_LITERAL_REINDEXER | 43 #endif  // V8_AST_AST_LITERAL_REINDEXER | 
| OLD | NEW | 
|---|