Ben Murdoch | 8b112d2 | 2011-06-08 16:22:53 +0100 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_REWRITER_H_ |
| 6 | #define V8_REWRITER_H_ |
| 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
Ben Murdoch | f87a203 | 2010-10-22 12:50:53 +0100 | [diff] [blame] | 11 | class CompilationInfo; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 12 | |
| 13 | class Rewriter { |
| 14 | public: |
Ben Murdoch | f87a203 | 2010-10-22 12:50:53 +0100 | [diff] [blame] | 15 | // Rewrite top-level code (ECMA 262 "programs") so as to conservatively |
| 16 | // include an assignment of the value of the last statement in the code to |
| 17 | // a compiler-generated temporary variable wherever needed. |
| 18 | // |
| 19 | // Assumes code has been parsed and scopes have been analyzed. Mutates the |
| 20 | // AST, so the AST should not continue to be used in the case of failure. |
| 21 | static bool Rewrite(CompilationInfo* info); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | |
| 25 | } } // namespace v8::internal |
| 26 | |
| 27 | #endif // V8_REWRITER_H_ |