Skip to content

Commit c10d020

Browse files
committed
Merge pull request #1951 from xzyfer/fix/issue-1907
Fix regression with evaluating interpolations next to binary operands
2 parents 3f5fde5 + 6630287 commit c10d020

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/eval.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,22 +504,22 @@ namespace Sass {
504504
}
505505

506506
// only the last item will be used to eval the binary expression
507-
if (String_Schema* s_1 = dynamic_cast<String_Schema*>(b->left())) {
508-
if (!s_1->is_right_interpolant()) {
509-
ret_schema = SASS_MEMORY_NEW(ctx.mem, String_Schema, s_1->pstate());
507+
if (String_Schema* s_l = dynamic_cast<String_Schema*>(b->left())) {
508+
if (!s_l->has_interpolant() && (!s_l->is_right_interpolant())) {
509+
ret_schema = SASS_MEMORY_NEW(ctx.mem, String_Schema, s_l->pstate());
510510
Binary_Expression* bin_ex = SASS_MEMORY_NEW(ctx.mem, Binary_Expression, b->pstate(),
511-
b->op(), s_1->last(), b->right());
511+
b->op(), s_l->last(), b->right());
512512
bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed());
513513
// bin_ex->is_interpolant(b->left()->is_interpolant());
514-
for (size_t i = 0; i < s_1->length() - 1; ++i) {
515-
*ret_schema << s_1->at(i)->perform(this);
514+
for (size_t i = 0; i < s_l->length() - 1; ++i) {
515+
*ret_schema << s_l->at(i)->perform(this);
516516
}
517517
*ret_schema << bin_ex->perform(this);
518518
return ret_schema->perform(this);
519519
}
520520
}
521521
if (String_Schema* s_r = dynamic_cast<String_Schema*>(b->right())) {
522-
if (!s_r->is_left_interpolant() || op_type == Sass_OP::DIV) {
522+
if (!s_r->has_interpolant() && (!s_r->is_left_interpolant() || op_type == Sass_OP::DIV)) {
523523
ret_schema = SASS_MEMORY_NEW(ctx.mem, String_Schema, s_r->pstate());
524524
Binary_Expression* bin_ex = SASS_MEMORY_NEW(ctx.mem, Binary_Expression, b->pstate(),
525525
b->op(), b->left(), s_r->first());
@@ -691,7 +691,7 @@ namespace Sass {
691691
}
692692
}
693693

694-
if (force_delay) {
694+
if (force_delay) {
695695
std::string str("");
696696
str += v_l->to_string(ctx.c_options);
697697
if (b->op().ws_before) str += " ";

0 commit comments

Comments
 (0)