OLD | NEW |
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 Loading... |
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_->GetClosureScope()); | 71 proxy->var()->scope() == param_scope_->ClosureScope()); |
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 Loading... |
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 |
OLD | NEW |