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

Unified Diff: src/parsing/parser.cc

Issue 2458653002: [modules] Move MODULE variable back to Scopes, before resolution (Closed)
Patch Set: Addressed comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 7ab02d6a1beca263ca9fc7c208074f99ff5e881e..61d63c7cec2624b3588383b763d71fd499d61f89 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1154,7 +1154,8 @@ ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports(
return nullptr;
}
- DeclareModuleImport(local_name, position(), CHECK_OK);
+ DeclareVariable(local_name, CONST, kNeedsInitialization, position(),
+ CHECK_OK);
NamedImport* import =
new (zone()) NamedImport(import_name, local_name, location);
@@ -1204,7 +1205,8 @@ void Parser::ParseImportDeclaration(bool* ok) {
import_default_binding =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID);
import_default_binding_loc = scanner()->location();
- DeclareModuleImport(import_default_binding, pos, CHECK_OK_VOID);
+ DeclareVariable(import_default_binding, CONST, kNeedsInitialization, pos,
+ CHECK_OK_VOID);
}
// Parse NameSpaceImport or NamedImports if present.
@@ -1481,21 +1483,6 @@ Declaration* Parser::DeclareVariable(const AstRawString* name,
return declaration;
}
-Declaration* Parser::DeclareModuleImport(const AstRawString* name, int pos,
- bool* ok) {
- DCHECK_EQ(MODULE_SCOPE, scope()->scope_type());
- Declaration* decl =
- DeclareVariable(name, CONST, kNeedsInitialization, pos, CHECK_OK);
- // Allocate imports eagerly as hole check elimination logic in scope
- // analisys depends on identifying imports.
- // TODO(adamk): It's weird to allocate imports long before everything
- // else. We should find a different way of filtering out imports
- // during hole check elimination.
- decl->proxy()->var()->AllocateTo(VariableLocation::MODULE,
- Variable::kModuleImportIndex);
- return decl;
-}
-
Variable* Parser::Declare(Declaration* declaration,
DeclarationDescriptor::Kind declaration_kind,
VariableMode mode, InitializationFlag init, bool* ok,
« no previous file with comments | « src/parsing/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698