OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 } | 1189 } |
1190 | 1190 |
1191 void DeclarationScope::ResetAfterPreparsing(bool aborted) { | 1191 void DeclarationScope::ResetAfterPreparsing(bool aborted) { |
1192 // Reset all non-trivial members. | 1192 // Reset all non-trivial members. |
1193 decls_.Clear(); | 1193 decls_.Clear(); |
1194 locals_.Clear(); | 1194 locals_.Clear(); |
1195 sloppy_block_function_map_.Clear(); | 1195 sloppy_block_function_map_.Clear(); |
1196 variables_.Clear(); | 1196 variables_.Clear(); |
1197 // Make sure we won't walk the scope tree from here on. | 1197 // Make sure we won't walk the scope tree from here on. |
1198 inner_scope_ = nullptr; | 1198 inner_scope_ = nullptr; |
1199 unresolved_ = nullptr; | |
1200 | 1199 |
1201 // TODO(verwaest): We should properly preparse the parameters (no declarations | 1200 // TODO(verwaest): We should properly preparse the parameters (no declarations |
1202 // should be created), and reparse on abort. | 1201 // should be created), and reparse on abort. |
1203 if (aborted) { | 1202 if (aborted) { |
1204 // Recreate declarations for parameters. | 1203 // Recreate declarations for parameters. |
1205 for (int i = 0; i < params_.length(); i++) { | 1204 for (int i = 0; i < params_.length(); i++) { |
1206 Variable* var = params_[i]; | 1205 Variable* var = params_[i]; |
1207 if (var->mode() == TEMPORARY) { | 1206 if (var->mode() == TEMPORARY) { |
1208 locals_.Add(var, zone()); | 1207 locals_.Add(var, zone()); |
1209 } else if (variables_.Lookup(var->raw_name()) == nullptr) { | 1208 } else if (variables_.Lookup(var->raw_name()) == nullptr) { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 Variable* function = | 1885 Variable* function = |
1887 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1886 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
1888 bool is_function_var_in_context = | 1887 bool is_function_var_in_context = |
1889 function != nullptr && function->IsContextSlot(); | 1888 function != nullptr && function->IsContextSlot(); |
1890 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1889 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1891 (is_function_var_in_context ? 1 : 0); | 1890 (is_function_var_in_context ? 1 : 0); |
1892 } | 1891 } |
1893 | 1892 |
1894 } // namespace internal | 1893 } // namespace internal |
1895 } // namespace v8 | 1894 } // namespace v8 |
OLD | NEW |