Skip to content

Commit 99eeeb4

Browse files
committed
Merge pull request #1350 from mgreter/fix/issue_1333
Fix special eval case for `String_Schema`
2 parents df23448 + 5b0bedd commit 99eeeb4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

eval.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,23 @@ namespace Sass {
905905
{
906906
string acc;
907907
for (size_t i = 0, L = s->length(); i < L; ++i) {
908-
if ((*s)[i]) acc += interpolation((*s)[i]);
908+
// really a very special fix, but this is the logic I got from
909+
// analyzing the ruby sass behavior and it actually seems to work
910+
// https://github.com/sass/libsass/issues/1333
911+
if (i == 0 && L > 1 && dynamic_cast<Function_Call*>((*s)[i])) {
912+
Expression* ex = (*s)[i]->perform(this);
913+
if (auto sq = dynamic_cast<String_Quoted*>(ex)) {
914+
if (sq->is_delayed() && ! s->has_interpolants()) {
915+
acc += string_escape(quote(sq->value(), sq->quote_mark()));
916+
} else {
917+
acc += interpolation((*s)[i]);
918+
}
919+
} else if (ex) {
920+
acc += interpolation((*s)[i]);
921+
}
922+
} else if ((*s)[i]) {
923+
acc += interpolation((*s)[i]);
924+
}
909925
}
910926
String_Quoted* str = new (ctx.mem) String_Quoted(s->pstate(), acc);
911927
if (!str->quote_mark()) {

0 commit comments

Comments
 (0)