lessphp icon indicating copy to clipboard operation
lessphp copied to clipboard

guarded recursion fails on exit

Open commonpike opened this issue 8 years ago • 0 comments

This

.recurse(@n, @i:0) when ( @i =< @n ) {
	.foo { border:@i; }
	.recurse( @n , (@i + 1) ); 
}
.recurse (5);

fails without a clear error message. plessc says

'src/less/loops.less on line 7ned: failed at '.recurse( @n , (@i + 1) );

the problem is apparently .recurse( 5,6 ); is not defined. this works fine :

.recurse(@n, @i:0) when ( @i =< @n ) {
	.foo { border:@i; }
	.recurse( @n , (@i + 1) ); 
}
.recurse(@n, @i:0) when ( @i > @n ) {
	// done
}
.recurse (5);

It makes some sense, but it's not documented (I think) and other libs don't do that afaik

commonpike avatar Nov 18 '17 12:11 commonpike