Changeset

12921:d238633a9d67

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.
author Kim Alvefur <zash@zash.se>
date Sun, 05 Mar 2023 14:07:08 +0100
parents 12920:cdb996637b08
children 12922:aaf055d6fe7a
files core/moduleapi.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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