| 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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1030   DCHECK(GetDeclarationScope()->is_being_lazily_parsed()); | 1030   DCHECK(GetDeclarationScope()->is_being_lazily_parsed()); | 
| 1031 | 1031 | 
| 1032   if (mode == VAR && !is_declaration_scope()) { | 1032   if (mode == VAR && !is_declaration_scope()) { | 
| 1033     return GetDeclarationScope()->DeclareVariableName(name, mode); | 1033     return GetDeclarationScope()->DeclareVariableName(name, mode); | 
| 1034   } | 1034   } | 
| 1035   DCHECK(!is_catch_scope()); | 1035   DCHECK(!is_catch_scope()); | 
| 1036   DCHECK(!is_with_scope()); | 1036   DCHECK(!is_with_scope()); | 
| 1037   DCHECK(!is_eval_scope()); | 1037   DCHECK(!is_eval_scope()); | 
| 1038   DCHECK(is_declaration_scope() || | 1038   DCHECK(is_declaration_scope() || | 
| 1039          (IsLexicalVariableMode(mode) && is_block_scope())); | 1039          (IsLexicalVariableMode(mode) && is_block_scope())); | 
|  | 1040   DCHECK(scope_info_.is_null()); | 
| 1040 | 1041 | 
| 1041   // Declare the variable in the declaration scope. | 1042   // Declare the variable in the declaration scope. | 
| 1042   if (LookupLocal(name) == nullptr) { | 1043   variables_.DeclareName(zone(), name); | 
| 1043     variables_.DeclareName(zone(), name); |  | 
| 1044   } |  | 
| 1045 } | 1044 } | 
| 1046 | 1045 | 
| 1047 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, | 1046 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, | 
| 1048                                     const AstRawString* name, | 1047                                     const AstRawString* name, | 
| 1049                                     int start_position, VariableKind kind) { | 1048                                     int start_position, VariableKind kind) { | 
| 1050   // Note that we must not share the unresolved variables with | 1049   // Note that we must not share the unresolved variables with | 
| 1051   // the same name because they may be removed selectively via | 1050   // the same name because they may be removed selectively via | 
| 1052   // RemoveUnresolved(). | 1051   // RemoveUnresolved(). | 
| 1053   DCHECK(!already_resolved_); | 1052   DCHECK(!already_resolved_); | 
| 1054   DCHECK_EQ(factory->zone(), zone()); | 1053   DCHECK_EQ(factory->zone(), zone()); | 
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2127   Variable* function = | 2126   Variable* function = | 
| 2128       is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2127       is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 
| 2129   bool is_function_var_in_context = | 2128   bool is_function_var_in_context = | 
| 2130       function != nullptr && function->IsContextSlot(); | 2129       function != nullptr && function->IsContextSlot(); | 
| 2131   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2130   return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 
| 2132          (is_function_var_in_context ? 1 : 0); | 2131          (is_function_var_in_context ? 1 : 0); | 
| 2133 } | 2132 } | 
| 2134 | 2133 | 
| 2135 }  // namespace internal | 2134 }  // namespace internal | 
| 2136 }  // namespace v8 | 2135 }  // namespace v8 | 
| OLD | NEW | 
|---|