Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,6 @@ protected function compileProp($prop, $block, $out) {
$this->zipSetArgs($mixin->args, $args);
}

$oldParent = $mixin->parent;
if ($mixin != $block) $mixin->parent = $block;

foreach ($this->sortProps($mixin->props) as $subProp) {
if ($suffix !== null &&
$subProp[0] == "assign" &&
Expand All @@ -665,8 +662,6 @@ protected function compileProp($prop, $block, $out) {
$this->compileProp($subProp, $mixin, $out);
}

$mixin->parent = $oldParent;

if ($haveArgs) $this->popEnv();
if ($haveScope) $this->popEnv();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ echo "have git and lessc installed."
echo ""

if [ -z "$input" ]; then
input="bootstrap/less/bootstrap.less"
input="bootstrap/less/responsive.less"
fi
dest=$(basename "$input")
dest="${dest%.*}"
Expand All @@ -28,7 +28,7 @@ echo ">> lessc compilation ($input)"
lessc "$input" "tmp/$dest.lessc.css"

echo ">> lessphp compilation ($input)"
../plessc "$input" "tmp/$dest.lessphp.css"
php ../plessc "$input" "tmp/$dest.lessphp.css"
echo ">> Cleanup and convert"

php sort.php "tmp/$dest.lessc.css" > "tmp/$dest.lessc.clean.css"
Expand Down
23 changes: 23 additions & 0 deletions tests/inputs/recursion.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.set(@width) {
.spanX(@index)when (@index > 0) {
(~".span@{index}") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed due to the latest changes into lessphp:

.span@{index} {

width: @width;
}
.spanX(@index - 1);
}

.spanX(0) {
}

.row {
.spanX (3);
}
}

.set1 {
.set(10px);
}

.set2 {
.set(33px);
}
18 changes: 18 additions & 0 deletions tests/outputs/recursion.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.set1 .row .span3 {
width: 10px;
}
.set1 .row .span2 {
width: 10px;
}
.set1 .row .span1 {
width: 10px;
}
.set2 .row .span3 {
width: 33px;
}
.set2 .row .span2 {
width: 33px;
}
.set2 .row .span1 {
width: 33px;
}
5 changes: 3 additions & 2 deletions tests/sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ function sortKey($block) {
}

function sortBlock($block) {
usort($block->children, function($a, $b) {
$sort = strcmp($this->sortKey($a), $this->sortKey($b));
$that = $this;
usort($block->children, function($a, $b) use ($that) {
$sort = strcmp($that->sortKey($a), $that->sortKey($b));
if ($sort == 0) {
// TODO
}
Expand Down