| 1 |
<?php |
| 2 |
/** |
| 3 |
* @private |
| 4 |
*/ |
| 5 |
class Less_Tree_DetachedRuleset extends Less_Tree { |
| 6 |
|
| 7 |
/** @var Less_Tree_Ruleset */ |
| 8 |
public $ruleset; |
| 9 |
/** @var array|null */ |
| 10 |
public $frames; |
| 11 |
|
| 12 |
public function __construct( $ruleset, $frames = null ) { |
| 13 |
$this->ruleset = $ruleset; |
| 14 |
$this->frames = $frames; |
| 15 |
} |
| 16 |
|
| 17 |
public function accept( $visitor ) { |
| 18 |
$this->ruleset = $visitor->visitObj( $this->ruleset ); |
| 19 |
} |
| 20 |
|
| 21 |
public function compile( $env ) { |
| 22 |
if ( $this->frames ) { |
| 23 |
$frames = $this->frames; |
| 24 |
} else { |
| 25 |
$frames = $env->frames; |
| 26 |
} |
| 27 |
return new self( $this->ruleset, $frames ); |
| 28 |
} |
| 29 |
|
| 30 |
public function callEval( $env ) { |
| 31 |
if ( $this->frames ) { |
| 32 |
return $this->ruleset->compile( $env->copyEvalEnv( array_merge( $this->frames, $env->frames ) ) ); |
| 33 |
} |
| 34 |
return $this->ruleset->compile( $env ); |
| 35 |
} |
| 36 |
} |