From 0d656f53afcb2784a341423a34442461cfc365b1 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 24 Jan 2012 18:53:53 +0100 Subject: [PATCH] Add comments --- lib/Twig/Parser.php | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Parser.php b/lib/Twig/Parser.php index 15325da..4b85259 100644 --- a/lib/Twig/Parser.php +++ b/lib/Twig/Parser.php @@ -62,6 +62,7 @@ class Twig_Parser implements Twig_ParserInterface */ public function parse(Twig_TokenStream $stream) { + // push all variables into the stack to keep the current state of the parser $vars = get_object_vars($this); unset($vars['stack'], $vars['env']); $this->stack[] = $vars; @@ -109,6 +110,7 @@ class Twig_Parser implements Twig_ParserInterface $node = $traverser->traverse($node); + // restore previous stack so previous parse() call can resume working foreach (array_pop($this->stack) as $key => $val) { $this->$key = $val; } -- 1.7.2.5