> */ private array $symbols = []; public function __construct( private Store $store, ) { } public function register(string $namespace, string $name, Extern $extern): void { $externVal = $this->store->register($extern); $this->symbols[$namespace][$name] = $externVal; } public function registerNamespace(string $namespace, ExporterInterface $exporter): void { foreach ($exporter->exports() as $export) { $this->symbols[$namespace][$export->name] = $export->value; } } /** * @return list */ public function resolve(Module $module): array { $externVals = []; foreach ($module->imports as $import) { $externVal = $this->symbols[$import->module][$import->name] ?? null; if ($externVal === null) { throw new LinkErrorException("import not found: {$import->module}::{$import->name}"); } $externVals[] = $externVal; } return $externVals; } }