• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
6 #define V8_AST_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
7 
8 #include "src/ast/ast-traversal-visitor.h"
9 #include "src/base/macros.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 // Changes the ID of all FunctionLiterals in the given Expression by adding the
15 // given delta.
16 class AstFunctionLiteralIdReindexer final
17     : public AstTraversalVisitor<AstFunctionLiteralIdReindexer> {
18  public:
19   AstFunctionLiteralIdReindexer(size_t stack_limit, int delta);
20   ~AstFunctionLiteralIdReindexer();
21 
22   void Reindex(Expression* pattern);
23 
24   // AstTraversalVisitor implementation.
25   void VisitFunctionLiteral(FunctionLiteral* lit);
26 
27  private:
28   int delta_;
29 
30   DISALLOW_COPY_AND_ASSIGN(AstFunctionLiteralIdReindexer);
31 };
32 
33 }  // namespace internal
34 }  // namespace v8
35 
36 #endif  // V8_AST_AST_FUNCTION_LITERAL_ID_REINDEXER_H_
37