0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-25 15:29:43 -05:00

add v8::Module::get_module_namespace (#177)

This commit is contained in:
Bartek Iwańczuk 2020-01-04 00:12:45 +01:00 committed by Ry Dahl
parent 19398816ab
commit 2d77996467
2 changed files with 10 additions and 0 deletions

View file

@ -1349,6 +1349,10 @@ void v8__Module__GetModuleRequestLocation(const v8::Module& self, int i,
*out = self.GetModuleRequestLocation(i); *out = self.GetModuleRequestLocation(i);
} }
v8::Value* v8__Module__GetModuleNamespace(v8::Module* self) {
return local_to_ptr(self->GetModuleNamespace());
}
int v8__Module__GetIdentityHash(const v8::Module& self) { int v8__Module__GetIdentityHash(const v8::Module& self) {
return self.GetIdentityHash(); return self.GetIdentityHash();
} }

View file

@ -30,6 +30,7 @@ extern "C" {
i: usize, i: usize,
out: &mut MaybeUninit<Location>, out: &mut MaybeUninit<Location>,
) -> Location; ) -> Location;
fn v8__Module__GetModuleNamespace(this: *mut Module) -> *mut Value;
fn v8__Module__GetIdentityHash(this: *const Module) -> int; fn v8__Module__GetIdentityHash(this: *const Module) -> int;
fn v8__Module__InstantiateModule( fn v8__Module__InstantiateModule(
this: *mut Module, this: *mut Module,
@ -113,6 +114,11 @@ impl Module {
unsafe { v8__Module__GetIdentityHash(self) } unsafe { v8__Module__GetIdentityHash(self) }
} }
/// Returns the identity hash for this object.
pub fn get_module_namespace(&mut self) -> Local<Value> {
unsafe { Local::from_raw(v8__Module__GetModuleNamespace(self)).unwrap() }
}
/// Instantiates the module and its dependencies. /// Instantiates the module and its dependencies.
/// ///
/// Returns an empty Maybe<bool> if an exception occurred during /// Returns an empty Maybe<bool> if an exception occurred during