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

Unified Diff: src/objects.cc

Issue 2360063002: [modules] Basic support of import statements. (Closed)
Patch Set: . 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9e633721fdeade0852f815df56fc9f7a11c35769..4a096aac44b12c1e453b1e01a8b869aaced80114 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -19608,5 +19608,16 @@ Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) {
return handle(cell->value(), isolate);
}
+Handle<Object> Module::LoadImport(Handle<Module> module, Handle<String> name,
+ int module_request) {
+ Isolate* isolate = module->GetIsolate();
+ Handle<Module> requested_module(
+ Module::cast(module->requested_modules()->get(module_request)), isolate);
+ Handle<ObjectHashTable> exports(requested_module->exports(), isolate);
+ Object* object = exports->Lookup(name);
+ if (!object->IsCell()) UNIMPLEMENTED();
+ return handle(Cell::cast(object)->value(), isolate);
+}
+
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698