private function JSParser::reduce in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_js_minify/jsminplus.inc \JSParser::reduce()
- 8.2 advagg_js_minify/jsminplus.inc \JSParser::reduce()
- 6 advagg_js_compress/jsminplus.inc \JSParser::reduce()
- 7.2 advagg_js_compress/jsminplus.inc \JSParser::reduce()
- 7 advagg_js_compress/jsminplus.inc \JSParser::reduce()
1 call to JSParser::reduce()
- JSParser::Expression in advagg_js_minify/
jsminplus.inc
File
- advagg_js_minify/
jsminplus.inc, line 1743 - JSMinPlus version 1.4
Class
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;
}