feature #3788 Add Compile::reset() (fabpot)

This PR was merged into the 3.x branch.

Discussion
----------

Add Compile::reset()

refs #3736

Commits
-------

824dbd9e Add Compile::reset()
This commit is contained in:
Fabien Potencier
2022-12-26 17:49:43 +01:00
+10 -1
View File
@@ -46,7 +46,7 @@ class Compiler
/**
* @return $this
*/
public function compile(Node $node, int $indentation = 0)
public function reset(int $indentation = 0)
{
$this->lastLine = null;
$this->source = '';
@@ -57,6 +57,15 @@ class Compiler
$this->indentation = $indentation;
$this->varNameSalt = 0;
return $this;
}
/**
* @return $this
*/
public function compile(Node $node, int $indentation = 0)
{
$this->reset($indentation);
$node->compile($this);
return $this;