1 | // Copyright 2011 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_PARSING_REWRITER_H_ |
6 | #define V8_PARSING_REWRITER_H_ |
7 | |
8 | #include "src/base/macros.h" |
9 | |
10 | namespace v8 { |
11 | namespace internal { |
12 | |
13 | class AstValueFactory; |
14 | class Isolate; |
15 | class ParseInfo; |
16 | class Parser; |
17 | class DeclarationScope; |
18 | class Scope; |
19 | |
20 | class Rewriter { |
21 | public: |
22 | // Rewrite top-level code (ECMA 262 "programs") so as to conservatively |
23 | // include an assignment of the value of the last statement in the code to |
24 | // a compiler-generated temporary variable wherever needed. |
25 | // |
26 | // Assumes code has been parsed and scopes have been analyzed. Mutates the |
27 | // AST, so the AST should not continue to be used in the case of failure. |
28 | V8_EXPORT_PRIVATE static bool Rewrite(ParseInfo* info); |
29 | }; |
30 | |
31 | |
32 | } // namespace internal |
33 | } // namespace v8 |
34 | |
35 | #endif // V8_PARSING_REWRITER_H_ |
36 | |