public function compile($env) { $name = $this->name; if (strpos($name, '@@') === 0) { $v = new Less_Tree_Variable(substr($name, 1), $this->index + 1); $name = '@' . $v->compile($env)->value; } if ($this->evaluating) { throw new Less_CompilerException("Recursive variable definition for " . $name, $this->index, null, $this->currentFileInfo['file']); } $this->evaluating = true; foreach ($env->frames as $frame) { if ($v = $frame->variable($name)) { $this->evaluating = false; return $v->value->compile($env); } } throw new Less_CompilerException("variable " . $name . " is undefined", $this->index, null); }
public function compile($env) { if ($this->name[1] === '@') { $v = new Less_Tree_Variable(substr($this->name, 1), $this->index + 1); $name = '@' . $v->compile($env)->value; } else { $name = $this->name; } if ($this->evaluating) { throw new Less_Exception_Compiler("Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo); } $this->evaluating = true; foreach ($env->frames as $frame) { if ($v = $frame->variable($name)) { $r = $v->value->compile($env); $this->evaluating = false; return $r; } } throw new Less_Exception_Compiler("variable " . $name . " is undefined", null, $this->index); }
public function compile($env) { $variable = new Less_Tree_Variable($this->variable); $detachedRuleset = $variable->compile($env); return $detachedRuleset->callEval($env); }