Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 37e15bb

Browse files
committed
Change String_Schema to only hold PreValue objects
The API does not guarantee yet that everything stored in `String_Schema` is a Value, although it doesn't make much sense to allow anything else and as it turns out we don't! Use steamroller tactics to ensure we don't store anything else after evaluation from Binary_Expression.
1 parent 0c5e27c commit 37e15bb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/ast.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,16 +1703,16 @@ namespace Sass {
17031703
// Interpolated strings. Meant to be reduced to flat strings during the
17041704
// evaluation phase.
17051705
///////////////////////////////////////////////////////////////////////
1706-
class String_Schema : public String, public Vectorized<Expression_Obj> {
1706+
class String_Schema : public String, public Vectorized<PreValue_Obj> {
17071707
ADD_PROPERTY(bool, css)
17081708
size_t hash_;
17091709
public:
17101710
String_Schema(ParserState pstate, size_t size = 0, bool css = true)
1711-
: String(pstate), Vectorized<Expression_Obj>(size), css_(css), hash_(0)
1711+
: String(pstate), Vectorized<PreValue_Obj>(size), css_(css), hash_(0)
17121712
{ concrete_type(STRING); }
17131713
String_Schema(const String_Schema* ptr)
17141714
: String(ptr),
1715-
Vectorized<Expression_Obj>(*ptr),
1715+
Vectorized<PreValue_Obj>(*ptr),
17161716
css_(ptr->css_),
17171717
hash_(ptr->hash_)
17181718
{ concrete_type(STRING); }

src/eval.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,9 @@ namespace Sass {
663663
b->op(), s_l->last(), b->right());
664664
bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // unverified
665665
for (size_t i = 0; i < s_l->length() - 1; ++i) {
666-
ret_schema->append(s_l->at(i)->perform(this));
666+
ret_schema->append(Cast<PreValue>(s_l->at(i)->perform(this)));
667667
}
668-
ret_schema->append(bin_ex->perform(this));
668+
ret_schema->append(Cast<PreValue>(bin_ex->perform(this)));
669669
return ret_schema->perform(this);
670670
}
671671
}
@@ -676,9 +676,9 @@ namespace Sass {
676676
Binary_Expression_Obj bin_ex = SASS_MEMORY_NEW(Binary_Expression, b->pstate(),
677677
b->op(), b->left(), s_r->first());
678678
bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // verified
679-
ret_schema->append(bin_ex->perform(this));
679+
ret_schema->append(Cast<PreValue>(bin_ex->perform(this)));
680680
for (size_t i = 1; i < s_r->length(); ++i) {
681-
ret_schema->append(s_r->at(i)->perform(this));
681+
ret_schema->append(Cast<PreValue>(s_r->at(i)->perform(this)));
682682
}
683683
return ret_schema->perform(this);
684684
}

0 commit comments

Comments
 (0)