2011-04-07 14:42:37 +00:00
|
|
|
// Copyright 2011 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_REWRITER_H_
|
|
|
|
#define V8_REWRITER_H_
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-03-09 14:51:13 +00:00
|
|
|
class ParseInfo;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
class Rewriter {
|
|
|
|
public:
|
2010-10-04 14:30:43 +00: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-03-09 14:51:13 +00:00
|
|
|
static bool Rewrite(ParseInfo* info);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_REWRITER_H_
|