2011-07-09 07:40:11 +08:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-05-12 11:07:46 +08:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2009-04-23 01:35:47 +08:00
|
|
|
|
|
|
|
#ifndef V8_REWRITER_H_
|
|
|
|
#define V8_REWRITER_H_
|
|
|
|
|
2009-06-09 00:34:06 +08:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2009-04-23 01:35:47 +08:00
|
|
|
|
2015-05-06 04:48:55 +08:00
|
|
|
class ParseInfo;
|
2009-04-23 01:35:47 +08:00
|
|
|
|
|
|
|
class Rewriter {
|
|
|
|
public:
|
2010-10-19 08:13:30 +08:00
|
|
|
// Rewrite top-level code (ECMA 262 "programs") so as to conservatively
|
|
|
|
// include an assignment of the value of the last statement in the code to
|
|
|
|
// a compiler-generated temporary variable wherever needed.
|
|
|
|
//
|
|
|
|
// Assumes code has been parsed and scopes have been analyzed. Mutates the
|
|
|
|
// AST, so the AST should not continue to be used in the case of failure.
|
2015-05-06 04:48:55 +08:00
|
|
|
static bool Rewrite(ParseInfo* info);
|
2009-04-23 01:35:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_REWRITER_H_
|