comparison vendor/twig/twig/lib/Twig/Node/Expression/Function.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php 1 <?php
2 2
3 /* 3 use Twig\Node\Expression\FunctionExpression;
4 * This file is part of Twig. 4
5 * 5 class_exists('Twig\Node\Expression\FunctionExpression');
6 * (c) Fabien Potencier 6
7 * 7 if (\false) {
8 * For the full copyright and license information, please view the LICENSE 8 class Twig_Node_Expression_Function extends FunctionExpression
9 * file that was distributed with this source code.
10 */
11 class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
12 {
13 public function __construct($name, Twig_NodeInterface $arguments, $lineno)
14 { 9 {
15 parent::__construct(['arguments' => $arguments], ['name' => $name, 'is_defined_test' => false], $lineno);
16 }
17
18 public function compile(Twig_Compiler $compiler)
19 {
20 $name = $this->getAttribute('name');
21 $function = $compiler->getEnvironment()->getFunction($name);
22
23 $this->setAttribute('name', $name);
24 $this->setAttribute('type', 'function');
25 $this->setAttribute('thing', $function);
26 $this->setAttribute('needs_environment', $function->needsEnvironment());
27 $this->setAttribute('needs_context', $function->needsContext());
28 $this->setAttribute('arguments', $function->getArguments());
29 if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
30 $callable = $function->getCallable();
31 if ('constant' === $name && $this->getAttribute('is_defined_test')) {
32 $callable = 'twig_constant_is_defined';
33 }
34
35 $this->setAttribute('callable', $callable);
36 }
37 if ($function instanceof Twig_SimpleFunction) {
38 $this->setAttribute('is_variadic', $function->isVariadic());
39 }
40
41 $this->compileCallable($compiler);
42 } 10 }
43 } 11 }
44
45 class_alias('Twig_Node_Expression_Function', 'Twig\Node\Expression\FunctionExpression', false);