Revert "simplified logic and improve perf slightly"
Revert "simplified logic and improve perf slightly"

This reverts commit 7030fdd76759de41fd0937f78f7be392ed63ebfb.

derickr/Twig,gamernetwork/Twig,nicolas-grekas/Twig,twigphp/Twig,nicolas-grekas/Twig,gamernetwork/Twig,apishka/templater,hhamon/Twig,dkarvounaris/Twig,gencer/Twig,hhamon/Twig,dkarvounaris/Twig,gamernetwork/Twig,derickr/Twig,gencer/Twig,twigphp/Twig,nicolas-grekas/Twig,hhamon/Twig,craue/Twig,derickr/Twig,nicolas-grekas/Twig,nicolas-grekas/Twig,craue/Twig,twigphp/Twig,dkarvounaris/Twig,apishka/templater