You are here

protected function Twig_Node_Module::compileGetParent in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Node/Module.php \Twig_Node_Module::compileGetParent()
1 call to Twig_Node_Module::compileGetParent()
Twig_Node_Module::compileTemplate in vendor/Twig/Node/Module.php

File

vendor/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");
}