Skip to content

Commit

Permalink
Soft error for dynamic mixin meanwhile implementing
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jun 27, 2017
1 parent aa979ee commit fae1c45
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Phug/Compiler/MixinCallCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Phug\CompilerException;
use Phug\Formatter\Element\DocumentElement;
use Phug\Formatter\Element\ExpressionElement;
use Phug\Formatter\Element\TextElement;
use Phug\Formatter\ElementInterface;
use Phug\Parser\Node\CodeNode;
use Phug\Parser\Node\MixinCallNode;
Expand All @@ -28,6 +29,11 @@ protected function proceedBlocks(NodeInterface $node, array $children)
}
}

protected function compileDynamicMixin($mixinName, ParserNodeInterface $node, ElementInterface $parent)
{
return new TextElement('Dynamic mixin names not yet supported.');
}

public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null)
{
if (!($node instanceof MixinCallNode)) {
Expand All @@ -38,6 +44,9 @@ public function compileNode(ParserNodeInterface $node, ElementInterface $parent

/** @var MixinCallNode $node */
$mixinName = $node->getName();
if (!is_string($mixinName)) {
return $this->compileDynamicMixin($mixinName, $node, $parent);
}
$compiler = $this->getCompiler();
/** @var MixinNode $declaration */
$declaration = $compiler->requireMixin($mixinName);
Expand Down

0 comments on commit fae1c45

Please sign in to comment.