- Added a new getExtensionInstanceOf() method in Compiler

This commit is contained in:
Dave Mc Nicoll committed 2026-10-22 15:15:38 +00:00
1 parent 0f95171575
commit 3d293aa417
1 file changed
+13
+13
View File
@@ -158,6 +158,19 @@ class Compiler
return $this->extensionList[$tokenName];
}
public function getExtensionInstanceOf(string $class) : Extension\Extension
{
foreach(array_reverse($this->extensionList) as $ext) {
if ( is_a($ext, $class, false) ) {
return $ext;
}
}
throw new \InvalidArgumentException(<<<MSG
Requested extension instance of `$class` could not be found from loaded Picea compiler's extension.
MSG);
}
public function exportFunctions() : void
{
static $caching = [];