Kahlan\Jit\Patcher\Monkey::_processTree PHP Method

_processTree() protected method

Helper for Monkey::process().
protected _processTree ( $parent )
    protected function _processTree($parent)
    {
        $hasScope = $parent instanceof FunctionDef || $parent->type === 'namespace';
        if ($hasScope) {
            $this->_variables[++$this->_depth] = [];
        }
        foreach ($parent->tree as $index => $node) {
            if (count($node->tree)) {
                $this->_processTree($node);
            }
            if ($node->processable && $node->type === 'code') {
                $this->_uses = $node->namespace ? $node->namespace->uses : [];
                $this->_monkeyPatch($node, $parent, $index);
            }
        }
        if ($hasScope) {
            $this->_flushVariables($parent);
            $this->_depth--;
        }
    }