| Index: src/ast/scopes.cc
|
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
|
| index beb572114451214ef6ee12a4ddbb54347e78c314..cb29376fc563c231280b616eb9311d5c3b3ff454 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));
|
| }
|
| @@ -701,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;
|
| @@ -1009,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() &&
|
|
|