protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
    {
        if (!$node instanceof Twig_Node_Print) {
            return $node;
        }

        $exprNode = $node->getNode('expr');
        if (
            $exprNode instanceof Twig_Node_Expression_BlockReference ||
            $exprNode instanceof Twig_Node_Expression_Parent
        ) {
            $exprNode->setAttribute('output', true);

            return $exprNode;
        }

        return $node;
    }