schmittjoh/twig.js — Issue #10: is not null expression missing brackets
Author: anod
Created: 2012-01-19 14:16:01+00:00
State: open

Hello,

Twig template contain next statement:
{% if item.review.subratings.location is not null %}

It is not compiled correctly:
if ((!null === twig.attr(twig.attr(twig.attr(tmp_item, "review"), "subratings"), "location"))) {

Expected result
if ((!(null === twig.attr(twig.attr(twig.attr(tmp_item, "review"), "subratings"), "location")))) {

Changing NoneCompiler to wrap subnodes with brackets fixes the issue.

$compiler
->raw('(null === ')
->subcompile($node->getNode('node'))
->raw(')')
;