core.moduleapi: Record reverse dependencies
authorKim Alvefur <zash@zash.se>
Sun, 05 Mar 2023 14:07:08 +0100
changeset 12925 d238633a9d67
parent 12924 cdb996637b08
child 12926 aaf055d6fe7a
core.moduleapi: Record reverse dependencies Useful to know why a module was auto-loaded without having to dig trough all other modules for the one that depends on it.
core/moduleapi.lua
--- a/core/moduleapi.lua	Sat Mar 04 18:40:43 2023 +0100
+++ b/core/moduleapi.lua	Sun Mar 05 14:07:08 2023 +0100
@@ -169,6 +169,10 @@
 		end
 	end
 	self.dependencies[name] = true;
+	if not mod.module.reverse_dependencies then
+		mod.module.reverse_dependencies = {};
+	end
+	mod.module.reverse_dependencies[self.name] = true;
 	return mod;
 end