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

Side by Side Diff: src/ast/scopes.cc

Issue 2375793002: Reland: [modules] Properly initialize declared variables. (Closed)
Patch Set: Created 4 years, 2 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 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 function_kind_(function_kind), 146 function_kind_(function_kind),
147 params_(4, zone), 147 params_(4, zone),
148 sloppy_block_function_map_(zone) { 148 sloppy_block_function_map_(zone) {
149 DCHECK_NE(scope_type, SCRIPT_SCOPE); 149 DCHECK_NE(scope_type, SCRIPT_SCOPE);
150 SetDefaults(); 150 SetDefaults();
151 asm_function_ = outer_scope_->IsAsmModule(); 151 asm_function_ = outer_scope_->IsAsmModule();
152 } 152 }
153 153
154 ModuleScope::ModuleScope(DeclarationScope* script_scope, 154 ModuleScope::ModuleScope(DeclarationScope* script_scope,
155 AstValueFactory* ast_value_factory) 155 AstValueFactory* ast_value_factory)
156 : DeclarationScope(ast_value_factory->zone(), script_scope, MODULE_SCOPE) { 156 : DeclarationScope(ast_value_factory->zone(), script_scope, MODULE_SCOPE,
157 kGeneratorFunction) {
157 Zone* zone = ast_value_factory->zone(); 158 Zone* zone = ast_value_factory->zone();
158 module_descriptor_ = new (zone) ModuleDescriptor(zone); 159 module_descriptor_ = new (zone) ModuleDescriptor(zone);
159 set_language_mode(STRICT); 160 set_language_mode(STRICT);
160 DeclareThis(ast_value_factory); 161 DeclareThis(ast_value_factory);
161 } 162 }
162 163
163 ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, 164 ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info,
164 AstValueFactory* avfactory) 165 AstValueFactory* avfactory)
165 : DeclarationScope(avfactory->zone(), MODULE_SCOPE, scope_info) { 166 : DeclarationScope(avfactory->zone(), MODULE_SCOPE, scope_info) {
166 Zone* zone = avfactory->zone(); 167 Zone* zone = avfactory->zone();
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 Variable* function = 1889 Variable* function =
1889 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 1890 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
1890 bool is_function_var_in_context = 1891 bool is_function_var_in_context =
1891 function != nullptr && function->IsContextSlot(); 1892 function != nullptr && function->IsContextSlot();
1892 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1893 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1893 (is_function_var_in_context ? 1 : 0); 1894 (is_function_var_in_context ? 1 : 0);
1894 } 1895 }
1895 1896
1896 } // namespace internal 1897 } // namespace internal
1897 } // namespace v8 1898 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/bootstrapper.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698