Skip to content

Commit

Permalink
Fix evaluation of unary expressions in loops
Browse files Browse the repository at this point in the history
Don't overwrite the original operand.
  • Loading branch information
mgreter committed Oct 4, 2019
1 parent 35b3293 commit 3d806e6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,19 @@ namespace Sass {
else if (Color* color = Cast<Color>(operand)) {
// Use the color name if this was eval with one
if (color->disp().length() > 0) {
operand = SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp());
u->operand(operand);
Unary_Expression_Obj cpy = SASS_MEMORY_COPY(u);
cpy->operand(SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp()));
return SASS_MEMORY_NEW(String_Quoted,
cpy->pstate(),
cpy->inspect());
}
}
else {
u->operand(operand);
Unary_Expression_Obj cpy = SASS_MEMORY_COPY(u);
cpy->operand(operand);
return SASS_MEMORY_NEW(String_Quoted,
cpy->pstate(),
cpy->inspect());
}

return SASS_MEMORY_NEW(String_Quoted,
Expand Down

0 comments on commit 3d806e6

Please sign in to comment.