| Index: src/ast/scopes.cc
|
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
|
| index 02b34335265bf72633fe0dc1486141b8d1aeae00..24942cf9dde78c22a8d56d253a85999848ac58f6 100644
|
| --- a/src/ast/scopes.cc
|
| +++ b/src/ast/scopes.cc
|
| @@ -176,8 +176,8 @@ ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info,
|
| // Deserialize special exports.
|
| Handle<FixedArray> special_exports = handle(module_info->special_exports());
|
| for (int i = 0, n = special_exports->length(); i < n; ++i) {
|
| - Handle<FixedArray> serialized_entry(
|
| - FixedArray::cast(special_exports->get(i)), isolate);
|
| + Handle<ModuleInfoEntry> serialized_entry(
|
| + ModuleInfoEntry::cast(special_exports->get(i)), isolate);
|
| module_descriptor_->AddSpecialExport(
|
| ModuleDescriptor::Entry::Deserialize(isolate, avfactory,
|
| serialized_entry),
|
| @@ -187,8 +187,8 @@ ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info,
|
| // Deserialize regular exports.
|
| Handle<FixedArray> regular_exports = handle(module_info->regular_exports());
|
| for (int i = 0, n = regular_exports->length(); i < n; ++i) {
|
| - Handle<FixedArray> serialized_entry(
|
| - FixedArray::cast(regular_exports->get(i)), isolate);
|
| + Handle<ModuleInfoEntry> serialized_entry(
|
| + ModuleInfoEntry::cast(regular_exports->get(i)), isolate);
|
| module_descriptor_->AddRegularExport(ModuleDescriptor::Entry::Deserialize(
|
| isolate, avfactory, serialized_entry));
|
| }
|
| @@ -461,12 +461,6 @@ void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
|
| scope->outer_scope()->scope_type() == SCRIPT_SCOPE ||
|
| scope->outer_scope()->already_resolved_);
|
|
|
| - // For modules, we want to start variable allocation at the surrounding script
|
| - // scope.
|
| - if (scope->is_module_scope()) {
|
| - scope = scope->outer_scope()->AsDeclarationScope();
|
| - }
|
| -
|
| scope->AllocateVariables(info, mode);
|
|
|
| #ifdef DEBUG
|
| @@ -707,7 +701,7 @@ Variable* DeclarationScope::DeclareParameter(
|
| const AstRawString* name, VariableMode mode, bool is_optional, bool is_rest,
|
| bool* is_duplicate, AstValueFactory* ast_value_factory) {
|
| DCHECK(!already_resolved_);
|
| - DCHECK(is_function_scope());
|
| + DCHECK(is_function_scope() || is_module_scope());
|
| DCHECK(!has_rest_);
|
| DCHECK(!is_optional || !is_rest);
|
| Variable* var;
|
| @@ -1015,6 +1009,16 @@ DeclarationScope* Scope::GetClosureScope() {
|
| return scope->AsDeclarationScope();
|
| }
|
|
|
| +ModuleScope* Scope::GetModuleScope() {
|
| + Scope* scope = this;
|
| + DCHECK(!scope->is_script_scope());
|
| + while (!scope->is_module_scope()) {
|
| + scope = scope->outer_scope();
|
| + DCHECK_NOT_NULL(scope);
|
| + }
|
| + return scope->AsModuleScope();
|
| +}
|
| +
|
| DeclarationScope* Scope::GetReceiverScope() {
|
| Scope* scope = this;
|
| while (!scope->is_script_scope() &&
|
|
|