Zephir\SymbolTable::markTemporalVariablesIdle PHP Method

markTemporalVariablesIdle() public method

Traverses temporal variables created in a specific branch marking them as idle
public markTemporalVariablesIdle ( zephir\CompilationContext $compilationContext )
$compilationContext zephir\CompilationContext
    public function markTemporalVariablesIdle(CompilationContext $compilationContext)
    {
        $compilationContext = $compilationContext ?: $this->compilationContext;
        $branchId = $compilationContext->branchManager->getCurrentBranchId();
        if (!isset($this->branchTempVariables[$branchId])) {
            return;
        }
        foreach ($this->branchTempVariables[$branchId] as $location => $typeVariables) {
            foreach ($typeVariables as $type => $variables) {
                foreach ($variables as $variable) {
                    $pos = strpos($variable->getName(), Variable::BRANCH_MAGIC);
                    $otherBranchId = 1;
                    if ($pos > -1) {
                        $otherBranchId = intval(substr($variable->getName(), $pos + strlen(Variable::BRANCH_MAGIC)));
                    }
                    if ($branchId == $otherBranchId) {
                        $variable->setIdle(true);
                    }
                }
            }
        }
    }