You are here

protected function Twig_Node_Module::compileGetParent in Zircon Profile 8

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

File

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