mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 03:16:34 +00:00
tweaked previous merge (refs #894)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.11.1 (2012-XX-XX)
|
||||
|
||||
* fixed debug info line numbering (was off by 2)
|
||||
* fixed escaping when calling a macro inside another one (regression introduced in 1.9.1)
|
||||
* optimized variable access on PHP 5.4
|
||||
* fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX)
|
||||
|
||||
@@ -76,7 +76,8 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
$this->lastLine = null;
|
||||
$this->source = '';
|
||||
$this->sourceOffset = 0;
|
||||
$this->sourceLine = 0;
|
||||
// source code starts at 1 (as we then increment it when we encounter new lines)
|
||||
$this->sourceLine = 1;
|
||||
$this->indentation = $indentation;
|
||||
|
||||
if ($node instanceof Twig_Node_Module) {
|
||||
@@ -207,6 +208,8 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
public function addDebugInfo(Twig_NodeInterface $node)
|
||||
{
|
||||
if ($node->getLine() != $this->lastLine) {
|
||||
$this->write("// line {$node->getLine()}\n");
|
||||
|
||||
// when mbstring.func_overload is set to 2
|
||||
// mb_substr_count() replaces substr_count()
|
||||
// but they have different signatures!
|
||||
@@ -217,10 +220,9 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
$this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset);
|
||||
}
|
||||
$this->sourceOffset = strlen($this->source);
|
||||
$this->debugInfo[$this->sourceLine + 2] = $node->getLine();
|
||||
$this->debugInfo[$this->sourceLine] = $node->getLine();
|
||||
|
||||
$this->lastLine = $node->getLine();
|
||||
$this->write("// line {$node->getLine()}\n");
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user