From 7c5854bba94fb5de06e4a145dee01d172fbf7523 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 8 Nov 2012 15:04:55 +0700 Subject: [PATCH] Fix twig error lineno off by 2 --- lib/Twig/Compiler.php | 2 +- test/Twig/Tests/Node/ModuleTest.php | 4 ++-- test/Twig/Tests/Node/SandboxedModuleTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Twig/Compiler.php b/lib/Twig/Compiler.php index 786a75f..a6868b2 100644 --- a/lib/Twig/Compiler.php +++ b/lib/Twig/Compiler.php @@ -217,7 +217,7 @@ class Twig_Compiler implements Twig_CompilerInterface $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); } $this->sourceOffset = strlen($this->source); - $this->debugInfo[$this->sourceLine] = $node->getLine(); + $this->debugInfo[$this->sourceLine + 2] = $node->getLine(); $this->lastLine = $node->getLine(); $this->write("// line {$node->getLine()}\n"); diff --git a/test/Twig/Tests/Node/ModuleTest.php b/test/Twig/Tests/Node/ModuleTest.php index dc3e2f1..9411e99 100644 --- a/test/Twig/Tests/Node/ModuleTest.php +++ b/test/Twig/Tests/Node/ModuleTest.php @@ -90,7 +90,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getDebugInfo() { - return array ( 17 => 1,); + return array ( 19 => 1,); } } EOF @@ -142,7 +142,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getDebugInfo() { - return array ( 22 => 1,); + return array ( 24 => 1,); } } EOF diff --git a/test/Twig/Tests/Node/SandboxedModuleTest.php b/test/Twig/Tests/Node/SandboxedModuleTest.php index 28fbddf..217e340 100644 --- a/test/Twig/Tests/Node/SandboxedModuleTest.php +++ b/test/Twig/Tests/Node/SandboxedModuleTest.php @@ -98,7 +98,7 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getDebugInfo() { - return array ( 18 => 1,); + return array ( 20 => 1,); } } EOF -- 1.7.2.5