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

Side by Side Diff: src/parsing/parameter-initializer-rewriter.cc

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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/parsing/parameter-initializer-rewriter.h" 5 #include "src/parsing/parameter-initializer-rewriter.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/ast-traversal-visitor.h" 8 #include "src/ast/ast-traversal-visitor.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 62
63 void Rewriter::VisitVariableProxy(VariableProxy* proxy) { 63 void Rewriter::VisitVariableProxy(VariableProxy* proxy) {
64 if (!proxy->is_resolved()) { 64 if (!proxy->is_resolved()) {
65 if (param_scope_->outer_scope()->RemoveUnresolved(proxy)) { 65 if (param_scope_->outer_scope()->RemoveUnresolved(proxy)) {
66 param_scope_->AddUnresolved(proxy); 66 param_scope_->AddUnresolved(proxy);
67 } 67 }
68 } else { 68 } else {
69 // Ensure that temporaries we find are already in the correct scope. 69 // Ensure that temporaries we find are already in the correct scope.
70 DCHECK(proxy->var()->mode() != TEMPORARY || 70 DCHECK(proxy->var()->mode() != TEMPORARY ||
71 proxy->var()->scope() == param_scope_->ClosureScope()); 71 proxy->var()->scope() == param_scope_->GetClosureScope());
72 } 72 }
73 } 73 }
74 74
75 75
76 void Rewriter::VisitBlock(Block* stmt) { 76 void Rewriter::VisitBlock(Block* stmt) {
77 if (stmt->scope() != nullptr) 77 if (stmt->scope() != nullptr)
78 stmt->scope()->ReplaceOuterScope(param_scope_); 78 stmt->scope()->ReplaceOuterScope(param_scope_);
79 else 79 else
80 VisitStatements(stmt->statements()); 80 VisitStatements(stmt->statements());
81 } 81 }
(...skipping 22 matching lines...) Expand all
104 DCHECK(param_scope->calls_sloppy_eval()); 104 DCHECK(param_scope->calls_sloppy_eval());
105 DCHECK(param_scope->outer_scope()->is_function_scope()); 105 DCHECK(param_scope->outer_scope()->is_function_scope());
106 106
107 Rewriter rewriter(stack_limit, expr, param_scope); 107 Rewriter rewriter(stack_limit, expr, param_scope);
108 rewriter.Run(); 108 rewriter.Run();
109 } 109 }
110 110
111 111
112 } // namespace internal 112 } // namespace internal
113 } // namespace v8 113 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698