9 class Less_Tree_Variable extends Less_Tree{
13 public $currentFileInfo;
14 public $evaluating = false;
15 public $type = 'Variable';
20 public function __construct($name, $index = null, $currentFileInfo = null) {
22 $this->index = $index;
23 $this->currentFileInfo = $currentFileInfo;
26 public function compile($env) {
28 if( $this->name[1] === '@' ){
29 $v = new Less_Tree_Variable(substr($this->name, 1), $this->index + 1, $this->currentFileInfo);
30 $name = '@' . $v->compile($env)->value;
35 if ($this->evaluating) {
36 throw new Less_Exception_Compiler("Recursive variable definition for " . $name, null, $this->index, $this->currentFileInfo);
39 $this->evaluating = true;
41 foreach($env->frames as $frame){
42 if( $v = $frame->variable($name) ){
43 $r = $v->value->compile($env);
44 $this->evaluating = false;
49 throw new Less_Exception_Compiler("variable " . $name . " is undefined in file ".$this->currentFileInfo["filename"], null, $this->index, $this->currentFileInfo);