Same name and namespace in other branches
  1. 6.0.x advagg_js_minify/jsminplus.inc \JSParser::reduce() 1 commentaire
  2. 7.x-1.x advagg_js_compress/jsminplus.inc \JSParser::reduce() 1 commentaire
  3. 7.x-2.x advagg_js_compress/jsminplus.inc \JSParser::reduce() 1 commentaire
  4. 8.x-2.x advagg_js_minify/jsminplus.inc \JSParser::reduce() 1 commentaire
  5. 8.x-3.x advagg_js_minify/jsminplus.inc \JSParser::reduce() 1 commentaire
  6. 8.x-4.x advagg_js_minify/jsminplus.inc \JSParser::reduce() 1 commentaire
1 call to JSParser::reduce()
JSParser::Expression dans advagg_js_minify/jsminplus.inc

Fichier

advagg_js_minify/jsminplus.inc, line 1743

Classe

JSParser

Code

private function reduce(&$operators, &$operands) {
    $n = array_pop($operators);
    $op = $n->type;
    $arity = $this->opArity[$op];
    $c = count($operands);
    if ($arity == -2) {
        // Flatten left-associative trees
        if ($c >= 2) {
            $left = $operands[$c - 2];
            if ($left->type == $op) {
                $right = array_pop($operands);
                $left->addNode($right);
                return $left;
            }
        }
        $arity = 2;
    }
    // Always use push to add operands to n, to update start and end
    $a = array_splice($operands, $c - $arity);
    for ($i = 0; $i < $arity; $i++) {
        $n->addNode($a[$i]);
    }
    // Include closing bracket or postfix operator in [start,end]
    $te = $this->t
        ->currentToken()->end;
    if ($n->end < $te) {
        $n->end = $te;
    }
    array_push($operands, $n);
    return $n;
}