protected function Twig_Node_Module::compileGetParent

1 call to Twig_Node_Module::compileGetParent()
Twig_Node_Module::compileTemplate in drupal/core/vendor/twig/twig/lib/Twig/Node/Module.php

File

drupal/core/vendor/twig/twig/lib/Twig/Node/Module.php, line 78

Class

Twig_Node_Module
Represents a module node.

Code

protected function compileGetParent(Twig_Compiler $compiler) {
  if (null === $this
    ->getNode('parent')) {
    return;
  }
  $compiler
    ->write("protected function doGetParent(array \$context)\n", "{\n")
    ->indent()
    ->write("return ");
  if ($this
    ->getNode('parent') instanceof Twig_Node_Expression_Constant) {
    $compiler
      ->subcompile($this
      ->getNode('parent'));
  }
  else {
    $compiler
      ->raw("\$this->env->resolveTemplate(")
      ->subcompile($this
      ->getNode('parent'))
      ->raw(")");
  }
  $compiler
    ->raw(";\n")
    ->outdent()
    ->write("}\n\n");
}