From 3d806e6cb631629ee5a9fc83baa334a1be2e9505 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Fri, 4 Oct 2019 19:13:19 +0200 Subject: [PATCH] Fix evaluation of unary expressions in loops Don't overwrite the original operand. --- src/eval.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/eval.cpp b/src/eval.cpp index a285bf373..67f079869 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -925,12 +925,19 @@ namespace Sass { else if (Color* color = Cast(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,