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

Unified Diff: src/parsing/parser.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/objects-inl.h ('k') | src/runtime/runtime.h » ('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 d24da8ab9097cb075313ea7d99f958cd0f05216a..1e61754b0c0fd0cf31c225b9f38266827017a574 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -742,6 +742,16 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
int beg_pos = scanner()->location().beg_pos;
parsing_module_ = info->is_module();
if (parsing_module_) {
+ // Declare the special module parameter.
+ auto name = ast_value_factory()->empty_string();
+ bool is_duplicate;
+ bool is_rest = false;
+ bool is_optional = false;
+ auto var = scope->DeclareParameter(name, VAR, is_optional, is_rest,
+ &is_duplicate, ast_value_factory());
+ DCHECK(!is_duplicate);
+ var->AllocateTo(VariableLocation::PARAMETER, 0);
+
ParseModuleItemList(body, &ok);
ok = ok &&
module()->Validate(this->scope()->AsModuleScope(),
@@ -785,9 +795,10 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
if (ok) {
RewriteDestructuringAssignments();
+ int parameter_count = parsing_module_ ? 1 : 0;
result = factory()->NewScriptOrEvalFunctionLiteral(
scope, body, function_state.materialized_literal_count(),
- function_state.expected_property_count());
+ function_state.expected_property_count(), parameter_count);
}
}
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698