mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-09 21:35:40 +00:00
Fix inheritance logic to be able to use instanceof ContextVariable instead of NameExpression
This commit is contained in:
@@ -16,6 +16,7 @@ use Twig\Compiler;
|
||||
use Twig\Node\Expression\AbstractExpression;
|
||||
use Twig\Node\Expression\NameExpression;
|
||||
use Twig\Node\Expression\Variable\AssignTemplateVariable;
|
||||
use Twig\Node\Expression\Variable\ContextVariable;
|
||||
|
||||
/**
|
||||
* Represents an import node.
|
||||
@@ -44,7 +45,7 @@ class ImportNode extends Node
|
||||
{
|
||||
$compiler->subcompile($this->getNode('var'));
|
||||
|
||||
if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) {
|
||||
if ($this->getNode('expr') instanceof ContextVariable && '_self' === $this->getNode('expr')->getAttribute('name')) {
|
||||
$compiler->raw('$this');
|
||||
} else {
|
||||
$compiler
|
||||
|
||||
Reference in New Issue
Block a user