@@ -305,11 +305,7 @@ public function loadFromExtension($extension, array $values = array())
305
305
*/
306
306
public function addCompilerPass (CompilerPassInterface $ pass , $ type = PassConfig::TYPE_BEFORE_OPTIMIZATION )
307
307
{
308
- if (null === $ this ->compiler ) {
309
- $ this ->compiler = new Compiler ();
310
- }
311
-
312
- $ this ->compiler ->addPass ($ pass , $ type );
308
+ $ this ->getCompiler ()->addPass ($ pass , $ type );
313
309
314
310
$ this ->addObjectResource ($ pass );
315
311
@@ -325,11 +321,7 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
325
321
*/
326
322
public function getCompilerPassConfig ()
327
323
{
328
- if (null === $ this ->compiler ) {
329
- $ this ->compiler = new Compiler ();
330
- }
331
-
332
- return $ this ->compiler ->getPassConfig ();
324
+ return $ this ->getCompiler ()->getPassConfig ();
333
325
}
334
326
335
327
/**
@@ -610,12 +602,10 @@ public function prependExtensionConfig($name, array $config)
610
602
*/
611
603
public function compile ()
612
604
{
613
- if (null === $ this ->compiler ) {
614
- $ this ->compiler = new Compiler ();
615
- }
605
+ $ compiler = $ this ->getCompiler ();
616
606
617
607
if ($ this ->trackResources ) {
618
- foreach ($ this -> compiler ->getPassConfig ()->getPasses () as $ pass ) {
608
+ foreach ($ compiler ->getPassConfig ()->getPasses () as $ pass ) {
619
609
$ this ->addObjectResource ($ pass );
620
610
}
621
611
@@ -626,7 +616,7 @@ public function compile()
626
616
}
627
617
}
628
618
629
- $ this -> compiler ->compile ($ this );
619
+ $ compiler ->compile ($ this );
630
620
631
621
$ this ->extensionConfigs = array ();
632
622
0 commit comments