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

Unified Diff: src/parsing/parser.cc

Issue 2199283002: [modules] Introduce new VariableLocation for module imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 4 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/interpreter/bytecode-generator.cc ('k') | test/cctest/test-parsing.cc » ('j') | 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 12231d13033bc710ef3eeaf8f1a764cbf488c504..233c4fc4aa058c0a2ac78b8cc649407363371241 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1588,6 +1588,7 @@ void Parser::ParseImportDeclaration(bool* ok) {
module_namespace_binding =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID);
module_namespace_binding_loc = scanner()->location();
+ DeclareImport(module_namespace_binding, pos, CHECK_OK_VOID);
break;
}
@@ -1609,17 +1610,17 @@ void Parser::ParseImportDeclaration(bool* ok) {
// Now that we have all the information, we can make the appropriate
// declarations.
- if (module_namespace_binding != nullptr) {
- module()->AddStarImport(module_namespace_binding, module_specifier,
- module_namespace_binding_loc, zone());
- // TODO(neis): Create special immutable binding for the namespace object.
- }
-
// TODO(neis): Would prefer to call DeclareImport below rather than above and
// in ParseNamedImports, but then a possible error message would point to the
// wrong location. Maybe have a DeclareAt version of Declare that takes a
// location?
+ if (module_namespace_binding != nullptr) {
+ module()->AddStarImport(module_namespace_binding, module_specifier,
+ module_namespace_binding_loc, zone());
+ // DeclareImport(module_namespace_binding, pos, CHECK_OK_VOID);
+ }
+
if (import_default_binding != nullptr) {
module()->AddImport(ast_value_factory()->default_string(),
import_default_binding, module_specifier,
@@ -1976,9 +1977,9 @@ VariableProxy* Parser::NewUnresolved(const AstRawString* name,
void Parser::DeclareImport(const AstRawString* local_name, int pos, bool* ok) {
DCHECK_NOT_NULL(local_name);
- VariableProxy* proxy = NewUnresolved(local_name, IMPORT);
+ VariableProxy* proxy = NewUnresolved(local_name, CONST);
Declaration* declaration =
- factory()->NewVariableDeclaration(proxy, IMPORT, scope(), pos);
+ factory()->NewVariableDeclaration(proxy, CONST, scope(), pos);
Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK_VOID);
}
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698