summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/TokenParser/Block.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/lib/Twig/TokenParser/Block.php')
-rw-r--r--inc/lib/Twig/TokenParser/Block.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/inc/lib/Twig/TokenParser/Block.php b/inc/lib/Twig/TokenParser/Block.php
index b31f7ed6..a2e017f3 100644
--- a/inc/lib/Twig/TokenParser/Block.php
+++ b/inc/lib/Twig/TokenParser/Block.php
@@ -35,8 +35,9 @@ class Twig_TokenParser_Block extends Twig_TokenParser
$stream = $this->parser->getStream();
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
if ($this->parser->hasBlock($name)) {
- throw new Twig_Error_Syntax("The block '$name' has already been defined", $lineno);
+ throw new Twig_Error_Syntax(sprintf("The block '$name' has already been defined line %d", $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename());
}
+ $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno));
$this->parser->pushLocalScope();
$this->parser->pushBlockStack($name);
@@ -48,7 +49,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
$value = $stream->next()->getValue();
if ($value != $name) {
- throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $lineno);
+ throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename());
}
}
} else {
@@ -58,8 +59,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);
- $block = new Twig_Node_Block($name, $body, $lineno);
- $this->parser->setBlock($name, $block);
+ $block->setNode('body', $body);
$this->parser->popBlockStack();
$this->parser->popLocalScope();
@@ -74,7 +74,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser
/**
* Gets the tag name associated with this token parser.
*
- * @param string The tag name
+ * @return string The tag name
*/
public function getTag()
{