PHPSA\Compiler\Expression\Operators\PreDec::compile PHP Метод

compile() защищенный Метод

--{expr}
protected compile ( PhpParser\Node\Expr\PreDec $expr, Context $context ) : CompiledExpression
$expr PhpParser\Node\Expr\PreDec
$context PHPSA\Context
Результат PHPSA\CompiledExpression
    protected function compile($expr, Context $context)
    {
        if ($expr->var instanceof \PHPParser\Node\Expr\Variable) {
            $variableName = $expr->var->name;
            if ($variableName instanceof Name) {
                $variableName = $variableName->parts[0];
            }
            $variable = $context->getSymbol($variableName);
            if ($variable) {
                $variable->incUse();
                switch ($variable->getType()) {
                    case CompiledExpression::INTEGER:
                    case CompiledExpression::DOUBLE:
                    case CompiledExpression::NUMBER:
                        $variable->dec();
                        return CompiledExpression::fromZvalValue($variable->getValue());
                }
                $context->notice('language_error', 'You are trying to use pre decrement operator on variable $' . $variableName . ' with type: ' . $variable->getTypeName(), $expr);
            } else {
                $context->notice('language_error', 'You are trying to use pre decrement operator on undefined variable: ' . $variableName, $expr);
            }
        }
        return new CompiledExpression();
    }
PreDec