*/
class Twig_Parser implements Twig_ParserInterface
{
+ protected $stack = array();
protected $stream;
protected $parent;
protected $handlers;
*/
public function parse(Twig_TokenStream $stream)
{
+ $vars = get_object_vars($this);
+ unset($vars['stack'], $vars['env']);
+ $this->stack[] = $vars;
+
$this->tmpVarCount = 0;
// tag handlers
$traverser = new Twig_NodeTraverser($this->env, $this->visitors);
- return $traverser->traverse($node);
+ $node = $traverser->traverse($node);
+
+ foreach (array_pop($this->stack) as $key => $val) {
+ $this->$key = $val;
+ }
+
+ return $node;
}
public function subparse($test, $dropNeedle = false)