Skip to content

Commit 3565f03

Browse files
committed
Implement Enum type resolution for ModuleFileLoader
1 parent b18480e commit 3565f03

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Module/Loader/ModuleFile/ModuleFileLoader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424

2525
use PackageFactory\ComponentEngine\Module\LoaderInterface;
2626
use PackageFactory\ComponentEngine\Parser\Ast\ComponentDeclarationNode;
27+
use PackageFactory\ComponentEngine\Parser\Ast\EnumDeclarationNode;
2728
use PackageFactory\ComponentEngine\Parser\Ast\ImportNode;
2829
use PackageFactory\ComponentEngine\Parser\Ast\ModuleNode;
2930
use PackageFactory\ComponentEngine\Parser\Ast\StructDeclarationNode;
3031
use PackageFactory\ComponentEngine\Parser\Source\Path;
3132
use PackageFactory\ComponentEngine\Parser\Source\Source;
3233
use PackageFactory\ComponentEngine\Parser\Tokenizer\Tokenizer;
3334
use PackageFactory\ComponentEngine\TypeSystem\Type\ComponentType\ComponentType;
35+
use PackageFactory\ComponentEngine\TypeSystem\Type\EnumType\EnumType;
3436
use PackageFactory\ComponentEngine\TypeSystem\Type\StructType\StructType;
3537
use PackageFactory\ComponentEngine\TypeSystem\TypeInterface;
3638

@@ -54,8 +56,8 @@ public function resolveTypeOfImport(ImportNode $importNode): TypeInterface
5456

5557
return match ($export->declaration::class) {
5658
ComponentDeclarationNode::class => ComponentType::fromComponentDeclarationNode($export->declaration),
57-
StructDeclarationNode::class => StructType::fromStructDeclarationNode($export->declaration),
58-
default => throw new \Exception('@TODO: Get type of ' . $export->declaration::class)
59+
EnumDeclarationNode::class => EnumType::fromEnumDeclarationNode($export->declaration),
60+
StructDeclarationNode::class => StructType::fromStructDeclarationNode($export->declaration)
5961
};
6062
}
6163
}

0 commit comments

Comments
 (0)