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

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

$a &= $b;
protected compile ( PhpParser\Node\Expr\AssignRef $expr, Context $context ) : CompiledExpression
$expr PhpParser\Node\Expr\AssignRef
$context PHPSA\Context
Результат PHPSA\CompiledExpression
    protected function compile($expr, Context $context)
    {
        $compiler = $context->getExpressionCompiler();
        if ($expr->var instanceof VariableNode) {
            $name = $expr->var->name;
            $compiledExpression = $compiler->compile($expr->expr);
            $symbol = $context->getSymbol($name);
            if ($symbol) {
                $symbol->modify($compiledExpression->getType(), $compiledExpression->getValue());
            } else {
                $symbol = new \PHPSA\Variable($name, $compiledExpression->getValue(), $compiledExpression->getType(), $context->getCurrentBranch());
                $context->addVariable($symbol);
            }
            if ($expr->expr instanceof VariableNode) {
                $rightVarName = $expr->expr->name;
                $rightSymbol = $context->getSymbol($rightVarName);
                if ($rightSymbol) {
                    $rightSymbol->incUse();
                    $symbol->setReferencedTo($rightSymbol);
                } else {
                    $context->debug('Cannot fetch variable by name: ' . $rightVarName);
                }
            }
            $symbol->incSets();
            return $compiledExpression;
        }
        $context->debug('Unknown how to pass symbol by ref');
        return new CompiledExpression();
    }
AssignRef