Add Compile::reset()

This commit is contained in:
Fabien Potencier
2022-12-26 17:09:36 +01:00
parent fe347bbf1b
commit 824dbd9e21
+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;