dotless/dotless — Issue #94: InvalidOperationException exception when having incorrect mixin call that contains variable
Author: HoLyVieR
Created: 2011-10-11 17:25:05+00:00
State: open

With this example :

.my-mixin (@param1, @param2)
{
color: @param1;
font-size: @param2;
}

@myColor: #000;

.my-mixin(@myColor);

It will throw an InvalidOperationException instead of logging a parse error the logger. I have trace down the problem to the fact that the Variable class doesn't implement the AppendCSS method. When the error string is being constructed to report that ".my-mixin" should take 2 parameters, [it will try to call AppendCSS on all the parameters](https://github.com/dotless/dotless/blob/master/src/dotless.Core/Parser/Tree/MixinCall.cs#L75), but Variable don't have an AppendCSS implementation and will call the [AppendCSS of the class Node](https://github.com/dotless/dotless/blob/master/src/dotless.Core/Parser/Infrastructure/Nodes/Node.cs#L93). What I propose is that the Variable class should have a basic implementation of AppendCSS which could be this :

public override void AppendCSS(Env env)
{
env.Output.Append(Name);
}