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

Unified Diff: src/parsing/parser.cc

Issue 2411873004: [ignition] Eliminate hole checks where statically possible for loads and stores (Closed)
Patch Set: Make MODULE allocation less ugly 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
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 18da7615f4557f94c76f35bd43f7e05c684a0985..addad2a32771f45471063fd8135093cc87818e0c 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1154,8 +1154,7 @@ ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports(
return nullptr;
}
- DeclareVariable(local_name, CONST, kNeedsInitialization, position(),
- CHECK_OK);
+ DeclareModuleImport(local_name, position(), CHECK_OK);
NamedImport* import = new (zone()) NamedImport(
import_name, local_name, scanner()->location());
@@ -1205,8 +1204,7 @@ void Parser::ParseImportDeclaration(bool* ok) {
import_default_binding =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID);
import_default_binding_loc = scanner()->location();
- DeclareVariable(import_default_binding, CONST, kNeedsInitialization, pos,
- CHECK_OK_VOID);
+ DeclareModuleImport(import_default_binding, pos, CHECK_OK_VOID);
}
// Parse NameSpaceImport or NamedImports if present.
@@ -1481,6 +1479,16 @@ 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);
+ 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,

Powered by Google App Engine
This is Rietveld 408576698