You are here

protected function Twig_Node_Module::compileGetParent in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.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 95

Class

Twig_Node_Module
Represents a module node.

Code

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