Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,9 @@ protected function set($name, $value) {
protected function get($name) {
$current = $this->env;

// track scope to evaluate
$scope_secondary = array();

$isArguments = $name == $this->vPrefix . 'arguments';
while ($current) {
if ($isArguments && isset($current->arguments)) {
Expand All @@ -1950,9 +1953,34 @@ protected function get($name) {
return $current->store[$name];
}

$current = isset($current->storeParent) ?
$current->storeParent :
$current->parent;
// has secondary scope?
if (isset($current->storeParent)) {
$scope_secondary[] = $current->storeParent;
}

$current = $current->parent;
}

// check secondary scopes
while ($scope_secondary) {
// pop scope off
$current = array_shift($scope_secondary);
while ($current) {
if ($isArguments && isset($current->arguments)) {
return array('list', ' ', $current->arguments);
}

if (isset($current->store[$name])) {
return $current->store[$name];
}

// has secondary scope?
if (isset($current->storeParent)) {
$scope_secondary[] = $current->storeParent;
}

$current = $current->parent;
}
}

$this->throwError("variable $name is undefined");
Expand Down