Twig_Loader base class has been removed, and the Twig_LoaderInterface has also
been changed (see the source code for more information or the documentation).
+ * fixed loop.last when the array only has one item
* made it possible to insert newlines in tag and variable blocks
* fixed a bug when a literal '\n' were present in a template text
* refactored loaders
->write("\$seq$var = twig_iterator_to_array(")
->subcompile($this->seq)
->raw(");\n")
- ->write("\$context['loop']['length'] = count(\$seq$var);\n")
+ ->write("\$length = count(\$seq$var);\n")
->write("\$context['loop'] = array(\n")
->write(" 'parent' => \$context['_parent'],\n")
- ->write(" 'length' => \$context['loop']['length'],\n")
+ ->write(" 'length' => \$length,\n")
->write(" 'index0' => 0,\n")
->write(" 'index' => 1,\n")
- ->write(" 'revindex0' => \$context['loop']['length'] - 1,\n")
- ->write(" 'revindex' => \$context['loop']['length'],\n")
+ ->write(" 'revindex0' => \$length - 1,\n")
+ ->write(" 'revindex' => \$length,\n")
->write(" 'first' => true,\n")
- ->write(" 'last' => false,\n")
+ ->write(" 'last' => 1 === \$length,\n")
->write(");\n")
->write("foreach (\$seq$var as \$context[")