Library/Expression/Reference.php
public function compile($expression, CompilationContext $compilationContext)
    {
        /*
         * Resolves the symbol that expects the value
         */
        if ($this->expecting) {
            if ($this->expectingVariable) {
                $symbolVariable = $this->expectingVariable;
                if ('variable' != $symbolVariable->getType()) {
                    throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' to store a reference', $expression);
                }
            } else {
                $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression);
            }
        } else {
            $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression);
        }

        $leftExpr = new Expression($expression['left']);
        $leftExpr->setReadOnly($this->readOnly);
        $left = $leftExpr->compile($compilationContext);

        switch ($left->getType()) {
            case 'variable':
            case 'string':
            case 'object':
            case 'array':
            case 'callable':
                break;
            default:
                throw new CompilerException('Cannot obtain a reference from type: '.$left->getType(), $expression);
        }

        $leftVariable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression);
        switch ($leftVariable->getType()) {
            case 'variable':
            case 'string':
            case 'object':
            case 'array':
            case 'callable':
                break;
            default:
                throw new CompilerException('Cannot obtain reference from variable type: '.$leftVariable->getType(), $expression);
        }

        $symbolVariable->setMustInitNull(true);
        $compilationContext->symbolTable->mustGrownStack(true);

        $symbolVariable->increaseVariantIfNull();
        $compilationContext->codePrinter->output('ZEPHIR_MAKE_REFERENCE('.$symbolVariable->getName().', '.$leftVariable->getName().');');

        return new CompiledExpression('reference', $symbolVariable->getRealName(), $expression);
    }
public function compile($expression, CompilationContext $compilationContext)
    {
        /*
         * Resolves the symbol that expects the value
         */
        if ($this->expecting) {
            if ($this->expectingVariable) {
                $symbolVariable = $this->expectingVariable;
                if ('variable' != $symbolVariable->getType()) {
                    throw new CompilerException('Cannot use variable type: '.$symbolVariable->getType().' to store a reference', $expression);
                }
            } else {
                $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression);
            }
        } else {
            $symbolVariable = $compilationContext->symbolTable->getTempVariableForWrite('variable', $compilationContext, $expression);
        }

        $leftExpr = new Expression($expression['left']);
        $leftExpr->setReadOnly($this->readOnly);
        $left = $leftExpr->compile($compilationContext);

        switch ($left->getType()) {
            case 'variable':
            case 'string':
            case 'object':
            case 'array':
            case 'callable':
                break;
            default:
                throw new CompilerException('Cannot obtain a reference from type: '.$left->getType(), $expression);
        }

        $leftVariable = $compilationContext->symbolTable->getVariableForRead($left->getCode(), $compilationContext, $expression);
        switch ($leftVariable->getType()) {
            case 'variable':
            case 'string':
            case 'object':
            case 'array':
            case 'callable':
                break;
            default:
                throw new CompilerException('Cannot obtain reference from variable type: '.$leftVariable->getType(), $expression);
        }

        $symbolVariable->setMustInitNull(true);
        $compilationContext->symbolTable->mustGrownStack(true);

        $symbolVariable->increaseVariantIfNull();
        $compilationContext->codePrinter->output('ZEPHIR_MAKE_REFERENCE('.$symbolVariable->getName().', '.$leftVariable->getName().');');

        return new CompiledExpression('reference', $symbolVariable->getRealName(), $expression);
    }
public function compile ( $ expression , CompilationContext $ compilationContext ) { /*
         * Resolves the symbol that expects the value
         */ if ( $ this -> expecting ) { if ( $ this -> expectingVariable ) { $ symbolVariable = $ this -> expectingVariable ; if ( 'variable' != $ symbolVariable -> getType ( ) ) { throw new CompilerException ( 'Cannot use variable type: ' . $ symbolVariable -> getType ( ) . ' to store a reference' , $ expression ) ; } } else { $ symbolVariable = $ compilationContext -> symbolTable -> getTempVariableForWrite ( 'variable' , $ compilationContext , $ expression ) ; } } else { $ symbolVariable = $ compilationContext -> symbolTable -> getTempVariableForWrite ( 'variable' , $ compilationContext , $ expression ) ; } $ leftExpr = new Expression ( $ expression [ 'left' ] ) ; $ leftExpr -> setReadOnly ( $ this -> readOnly ) ; $ left = $ leftExpr -> compile ( $ compilationContext ) ; switch ( $ left -> getType ( ) ) { case 'variable' : case 'string' : case 'object' : case 'array' : case 'callable' : break ; default : throw new CompilerException ( 'Cannot obtain a reference from type: ' . $ left -> getType ( ) , $ expression ) ; } $ leftVariable = $ compilationContext -> symbolTable -> getVariableForRead ( $ left -> getCode ( ) , $ compilationContext , $ expression ) ; switch ( $ leftVariable -> getType ( ) ) { case 'variable' : case 'string' : case 'object' : case 'array' : case 'callable' : break ; default : throw new CompilerException ( 'Cannot obtain reference from variable type: ' . $ leftVariable -> getType ( ) , $ expression ) ; } $ symbolVariable -> setMustInitNull ( true ) ; $ compilationContext -> symbolTable -> mustGrownStack ( true ) ; $ symbolVariable -> increaseVariantIfNull ( ) ; $ compilationContext -> codePrinter -> output ( 'ZEPHIR_MAKE_REFERENCE(' . $ symbolVariable -> getName ( ) . ', ' . $ leftVariable -> getName ( ) . ');' ) ; return new CompiledExpression ( 'reference' , $ symbolVariable -> getRealName ( ) , $ expression ) ; }
Compiles a reference to a value.

@param array              $expression
@param CompilationContext $compilationContext

@return CompiledExpression
Compiles a reference to a value .