function ImportNode::compile
Overrides Node::compile
File
-
vendor/
twig/ twig/ src/ Node/ ImportNode.php, line 43
Class
- ImportNode
- Represents an import node.
Namespace
Twig\NodeCode
public function compile(Compiler $compiler) : void {
$compiler->subcompile($this->getNode('var'));
if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')
->getAttribute('name')) {
$compiler->raw('$this');
}
else {
$compiler->raw('$this->loadTemplate(')
->subcompile($this->getNode('expr'))
->raw(', ')
->repr($this->getTemplateName())
->raw(', ')
->repr($this->getTemplateLine())
->raw(')->unwrap()');
}
$compiler->raw(";\n");
}