summaryrefslogtreecommitdiff
path: root/core/modules.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules.rs')
-rw-r--r--core/modules.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/core/modules.rs b/core/modules.rs
index 9352301ba..d1e871ba9 100644
--- a/core/modules.rs
+++ b/core/modules.rs
@@ -1093,6 +1093,28 @@ impl ModuleMap {
output
}
+ pub(crate) fn assert_all_modules_evaluated(
+ &self,
+ scope: &mut v8::HandleScope,
+ ) {
+ let mut not_evaluated = vec![];
+
+ for (i, handle) in self.handles.iter().enumerate() {
+ let module = v8::Local::new(scope, handle);
+ if !matches!(module.get_status(), v8::ModuleStatus::Evaluated) {
+ not_evaluated.push(self.info[i].name.as_str().to_string());
+ }
+ }
+
+ if !not_evaluated.is_empty() {
+ let mut msg = "Following modules were not evaluated; make sure they are imported from other code:\n".to_string();
+ for m in not_evaluated {
+ msg.push_str(&format!(" - {}\n", m));
+ }
+ panic!("{}", msg);
+ }
+ }
+
pub fn serialize_for_snapshotting(
&self,
scope: &mut v8::HandleScope,
@@ -1366,7 +1388,7 @@ impl ModuleMap {
/// Get module id, following all aliases in case of module specifier
/// that had been redirected.
- fn get_id(
+ pub(crate) fn get_id(
&self,
name: impl AsRef<str>,
asserted_module_type: AssertedModuleType,