Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1210)

Side by Side Diff: src/parsing/rewriter.h

Issue 2209573002: Separate Scope into DeclarationScope and Scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move has_simple_parameters_ to DeclarationScope Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_REWRITER_H_ 5 #ifndef V8_PARSING_REWRITER_H_
6 #define V8_PARSING_REWRITER_H_ 6 #define V8_PARSING_REWRITER_H_
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
11 class AstValueFactory; 11 class AstValueFactory;
12 class DoExpression; 12 class DoExpression;
13 class ParseInfo; 13 class ParseInfo;
14 class Parser; 14 class Parser;
15 class DeclarationScope;
15 class Scope; 16 class Scope;
16 17
17 class Rewriter { 18 class Rewriter {
18 public: 19 public:
19 // Rewrite top-level code (ECMA 262 "programs") so as to conservatively 20 // Rewrite top-level code (ECMA 262 "programs") so as to conservatively
20 // include an assignment of the value of the last statement in the code to 21 // include an assignment of the value of the last statement in the code to
21 // a compiler-generated temporary variable wherever needed. 22 // a compiler-generated temporary variable wherever needed.
22 // 23 //
23 // Assumes code has been parsed and scopes have been analyzed. Mutates the 24 // Assumes code has been parsed and scopes have been analyzed. Mutates the
24 // AST, so the AST should not continue to be used in the case of failure. 25 // AST, so the AST should not continue to be used in the case of failure.
25 static bool Rewrite(ParseInfo* info); 26 static bool Rewrite(ParseInfo* info);
26 27
27 // Rewrite a list of statements, using the same rules as a top-level program, 28 // Rewrite a list of statements, using the same rules as a top-level program,
28 // to ensure identical behaviour of completion result. The temporary is added 29 // to ensure identical behaviour of completion result. The temporary is added
29 // to the closure scope of the do-expression, which matches the closure scope 30 // to the closure scope of the do-expression, which matches the closure scope
30 // of the outer scope (the do-expression itself runs in a block scope, not a 31 // of the outer scope (the do-expression itself runs in a block scope, not a
31 // closure scope). This closure scope needs to be passed in since the 32 // closure scope). This closure scope needs to be passed in since the
32 // do-expression could have dropped its own block scope. 33 // do-expression could have dropped its own block scope.
33 static bool Rewrite(Parser* parser, Scope* closure_scope, DoExpression* expr, 34 static bool Rewrite(Parser* parser, DeclarationScope* closure_scope,
34 AstValueFactory* factory); 35 DoExpression* expr, AstValueFactory* factory);
35 }; 36 };
36 37
37 38
38 } // namespace internal 39 } // namespace internal
39 } // namespace v8 40 } // namespace v8
40 41
41 #endif // V8_PARSING_REWRITER_H_ 42 #endif // V8_PARSING_REWRITER_H_
OLDNEW
« src/ast/scopes.cc ('K') | « src/parsing/preparser.cc ('k') | src/parsing/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698