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

Unified Diff: src/ast/scopes.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: Disable module tests for deopt fuzzer. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.h ('k') | src/ast/variables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index b74d7ab824f7c2c1e6f83d342fe71beaca43e820..2443063e2a7a00869287fcfa044faa929660eaa4 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -171,8 +171,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),
@@ -182,8 +182,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));
}
@@ -829,7 +829,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;
@@ -1164,6 +1164,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() &&
« no previous file with comments | « src/ast/scopes.h ('k') | src/ast/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698