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

Unified Diff: src/parser.cc

Issue 11093074: Get rid of static module allocation, do it in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed last comments; added other back-ends Created 8 years, 1 month 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.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 129bd95466520ef87de7bc6e7c5ac61234cd9f48..65008fd79b39cc9188407264fb42bae4bb0bad84 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1160,7 +1160,7 @@ Statement* Parser::ParseModuleDeclaration(ZoneStringList* names, bool* ok) {
#endif
Module* module = ParseModule(CHECK_OK);
- VariableProxy* proxy = NewUnresolved(name, LET, module->interface());
+ VariableProxy* proxy = NewUnresolved(name, MODULE, module->interface());
Declaration* declaration =
factory()->NewModuleDeclaration(proxy, module, top_scope_);
Declare(declaration, true, CHECK_OK);
@@ -1179,7 +1179,7 @@ Statement* Parser::ParseModuleDeclaration(ZoneStringList* names, bool* ok) {
if (module->body() == NULL)
return factory()->NewEmptyStatement();
else
- return module->body();
+ return factory()->NewModuleStatement(proxy, module->body());
}
@@ -1328,12 +1328,15 @@ Module* Parser::ParseModuleUrl(bool* ok) {
if (FLAG_print_interface_details) PrintF("# Url ");
#endif
- Module* result = factory()->NewModuleUrl(symbol);
- Interface* interface = result->interface();
+ // Create an empty literal as long as the feature isn't finished.
+ USE(symbol);
+ Scope* scope = NewScope(top_scope_, MODULE_SCOPE);
+ Block* body = factory()->NewBlock(NULL, 1, false);
+ body->set_scope(scope);
+ Interface* interface = scope->interface();
+ Module* result = factory()->NewModuleLiteral(body, interface);
interface->Freeze(ok);
ASSERT(*ok);
- // Create dummy scope to avoid errors as long as the feature isn't finished.
- Scope* scope = NewScope(top_scope_, MODULE_SCOPE);
interface->Unify(scope->interface(), zone(), ok);
ASSERT(*ok);
return result;
@@ -1702,10 +1705,9 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
*ok = false;
return;
}
- const char* type =
- (var->mode() == VAR) ? "var" : var->is_const_mode() ? "const" : "let";
Handle<String> type_string =
- isolate()->factory()->NewStringFromUtf8(CStrVector(type), TENURED);
+ isolate()->factory()->NewStringFromUtf8(CStrVector("Variable"),
+ TENURED);
Expression* expression =
NewThrowTypeError(isolate()->factory()->redeclaration_symbol(),
type_string, name);
« no previous file with comments | « src/objects.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698