Skip to content

Commit

Permalink
Don't apply unary operations on colors
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer committed Sep 25, 2016
1 parent 8cd9434 commit 56c1e99
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,20 @@ namespace Sass {
if (operand->concrete_type() == Expression::NULL_VAL && dynamic_cast<Variable*>(u->operand())) {
u->operand(SASS_MEMORY_NEW(ctx.mem, String_Quoted, u->pstate(), ""));
}
else u->operand(operand);
// Never apply unary opertions on colors @see #2140
else if (operand->concrete_type() == Expression::COLOR) {
Color* c = dynamic_cast<Color*>(operand);

// Use the color name if this was eval with one
if (c->disp().length() > 0) {
operand = SASS_MEMORY_NEW(ctx.mem, String_Constant, operand->pstate(), c->disp());
u->operand(operand);
}
}
else {
u->operand(operand);
}

String_Constant* result = SASS_MEMORY_NEW(ctx.mem, String_Quoted,
u->pstate(),
u->inspect());
Expand Down

0 comments on commit 56c1e99

Please sign in to comment.