Skip to content

Commit 23cabbe

Browse files
authored
Merge pull request #2996 from mgreter/bugfix/2980-fix-unary-expr-eval
Fix evaluation of unary expressions in loops
2 parents 408a883 + 3d806e6 commit 23cabbe

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/eval.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -925,12 +925,19 @@ namespace Sass {
925925
else if (Color* color = Cast<Color>(operand)) {
926926
// Use the color name if this was eval with one
927927
if (color->disp().length() > 0) {
928-
operand = SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp());
929-
u->operand(operand);
928+
Unary_Expression_Obj cpy = SASS_MEMORY_COPY(u);
929+
cpy->operand(SASS_MEMORY_NEW(String_Constant, operand->pstate(), color->disp()));
930+
return SASS_MEMORY_NEW(String_Quoted,
931+
cpy->pstate(),
932+
cpy->inspect());
930933
}
931934
}
932935
else {
933-
u->operand(operand);
936+
Unary_Expression_Obj cpy = SASS_MEMORY_COPY(u);
937+
cpy->operand(operand);
938+
return SASS_MEMORY_NEW(String_Quoted,
939+
cpy->pstate(),
940+
cpy->inspect());
934941
}
935942

936943
return SASS_MEMORY_NEW(String_Quoted,

0 commit comments

Comments
 (0)