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

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: Comment 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
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index bfa5e1c27bf89800af62604c7d3a59993f6e4693..757b1e78916bb33a4f6fd47ce9974f2ea3eaa2b7 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1555,6 +1555,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;
}
@@ -1576,17 +1577,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);
adamk 2016/08/02 16:34:31 Leave a TODO here?
neis 2016/08/03 09:16:30 Hmm? This is the same as all the other DeclareImpo
adamk 2016/08/03 17:51:26 Oops, didn't look in the right place, I get it.
+ }
+
if (import_default_binding != nullptr) {
module()->AddImport(ast_value_factory()->default_string(),
import_default_binding, module_specifier,
@@ -1943,9 +1944,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);
}

Powered by Google App Engine
This is Rietveld 408576698