Пример #1
0
 /**
  * Compiles the node
  *
  * @param ILess_Environment $env
  */
 public function compile(ILess_Environment $env, $arguments = null, $important = null)
 {
     $inParenthesis = $this->parens && !$this->parensInOp;
     $doubleParen = false;
     if ($inParenthesis) {
         $env->inParenthesis();
     }
     $count = count($this->value);
     if ($count > 1) {
         $compiled = array();
         foreach ($this->value as $v) {
             $compiled[] = $v->compile($env);
         }
         $return = new ILess_Node_Expression($compiled);
     } elseif ($count === 1) {
         if (!isset($this->value[0])) {
             $this->value = array_slice($this->value, 0);
         }
         if (property_exists($this->value[0], 'parens') && $this->value[0]->parens && property_exists($this->value[0], 'parensInOp') && !$this->value[0]->parensInOp) {
             $doubleParen = true;
         }
         $return = $this->value[0]->compile($env);
     } else {
         $return = $this;
     }
     if ($inParenthesis) {
         $env->outOfParenthesis();
     }
     if ($this->parens && $this->parensInOp && !$env->isMathOn() && !$doubleParen) {
         $return = new ILess_Node_Paren($return);
     }
     return $return;
 }