lookupBaseModuleByName function

String lookupBaseModuleByName(
  1. Map table,
  2. String function
)

The base module that declares bare function, or '' if none does. Companion to lookupCapabilityByName (same globally-unique-bare-name guarantee, so at most one module matches) — resolves the owning module so the audit can name the shadowed base function in full, e.g. std_concurrency.mutex_create (issue #420).

Implementation

String lookupBaseModuleByName(Map table, String function) {
  final modules = capabilityModuleNames();
  for (final m in modules) {
    final cap = lookupCapability(table, m, function);
    if (cap.isNotEmpty) {
      return m;
    }
  }
  return '';
}