Skip to content

Commit

Permalink
Remove InstallBuiltinModule and refactor Compiler
Browse files Browse the repository at this point in the history
The InstallBuiltinModule file has been removed and the Compiler file has been refactored. Instead of using InstallBuiltinModule, DiCompileModule is now installed directly in Compiler. Furthermore, the container generation logic in the Compiler has been updated to use a ContainerFactory. This contributes to
  • Loading branch information
koriym committed May 23, 2024
1 parent 9747f42 commit aa6805a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
9 changes: 3 additions & 6 deletions src/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Ray\Compiler;

use Ray\Aop\Compiler as AopCompiler;
use Ray\Compiler\Exception\CompileLockFailed;
use Ray\Di\AbstractModule;
use Ray\Di\AcceptInterface;
use Ray\Di\ContainerFactory;
use Ray\Di\DependencyInterface;

use function assert;
Expand Down Expand Up @@ -37,11 +37,8 @@ public function compile(AbstractModule $module, string $scriptDir): Scripts
}

$scripts = new Scripts();
$container = (new InstallBuiltinModule())($module)->getContainer();
// Compile null objects
(new CompileNullObject())($container, $scriptDir);
// Compile aspects
$container->weaveAspects(new AopCompiler($scriptDir));
$module->install(new DiCompileModule(true));
$container = (new ContainerFactory())($module, $scriptDir);
// Compile dependencies
$compileVisitor = new CompileVisitor($container);
$container->map(static function (DependencyInterface $dependency, string $key) use ($scripts, $compileVisitor): DependencyInterface {
Expand Down
29 changes: 0 additions & 29 deletions src/InstallBuiltinModule.php

This file was deleted.

0 comments on commit aa6805a

Please sign in to comment.