@@ -49,12 +49,12 @@ namespace Sass {
49
49
50
50
bool Value::_selectorStringOrNull (Logger& logger, sass::string& rv) {
51
51
52
- if (String_Constant* str = Cast<String_Constant>( this )) {
52
+ if (String_Constant* str = isString ( )) {
53
53
rv = str->value ();
54
54
return true ;
55
55
}
56
56
57
- if (SassList * list = Cast<SassList>( this )) {
57
+ if (SassList * list = isList ( )) {
58
58
59
59
sass::vector<ValueObj> values = list->asVector ();
60
60
@@ -63,8 +63,8 @@ namespace Sass {
63
63
sass::vector<sass::string> result;
64
64
if (list->separator () == SASS_COMMA) {
65
65
for (auto complex : values) {
66
- SassList* cplxLst = Cast<SassList>(complex );
67
- String_Constant* cplxStr = Cast<String_Constant>(complex );
66
+ SassList* cplxLst = complex-> isList ( );
67
+ String_Constant* cplxStr = complex-> isString ( );
68
68
if (cplxStr) {
69
69
result.emplace_back (cplxStr->value ());
70
70
}
@@ -82,7 +82,7 @@ namespace Sass {
82
82
}
83
83
else {
84
84
for (auto compound : values) {
85
- String_Constant* cmpdStr = Cast<String_Constant>(compound );
85
+ String_Constant* cmpdStr = compound-> isString ( );
86
86
if (cmpdStr) {
87
87
result.emplace_back (cmpdStr->value ());
88
88
}
@@ -174,7 +174,7 @@ namespace Sass {
174
174
// The SassScript `+` operation.
175
175
inline Value* Value::plus (
176
176
Value* other, Logger& logger, const SourceSpan& pstate) const {
177
- if (String_Constant * str = Cast<String_Constant>(other )) {
177
+ if (String_Constant * str = other-> isString ( )) {
178
178
sass::string text (toCssString () + str->value ());
179
179
return SASS_MEMORY_NEW (String_Constant,
180
180
pstate, text, str->hasQuotes ());
@@ -263,7 +263,7 @@ namespace Sass {
263
263
// at the same key, order is not important.
264
264
bool Map::operator == (const Value& rhs) const
265
265
{
266
- if (const Map* r = Cast<Map>(& rhs)) {
266
+ if (const Map* r = rhs. isMap ( )) {
267
267
if (size () != r->size ()) return false ;
268
268
for (auto kv : elements_) {
269
269
auto lv = kv.second ;
@@ -274,7 +274,7 @@ namespace Sass {
274
274
}
275
275
return true ;
276
276
}
277
- if (const SassList * r = Cast<SassList>(& rhs)) {
277
+ if (const SassList * r = rhs. isList ( )) {
278
278
return r->empty () && empty ();
279
279
}
280
280
return false ;
@@ -415,7 +415,7 @@ namespace Sass {
415
415
416
416
bool Number::operator == (const Value& rhs) const
417
417
{
418
- if (const Number* n = Cast<Number>(& rhs)) {
418
+ if (const Number* n = rhs. isNumber ( )) {
419
419
return *this == *n;
420
420
}
421
421
return false ;
@@ -574,7 +574,7 @@ namespace Sass {
574
574
575
575
bool Color_RGBA::operator == (const Value& rhs) const
576
576
{
577
- if (auto r = Cast<Color_RGBA>(& rhs)) {
577
+ if (auto r = rhs. isColorRGBA ( )) {
578
578
return r_ == r->r () &&
579
579
g_ == r->g () &&
580
580
b_ == r->b () &&
@@ -659,7 +659,7 @@ namespace Sass {
659
659
660
660
bool Color_HSLA::operator == (const Value& rhs) const
661
661
{
662
- if (auto r = Cast<Color_HSLA>(& rhs)) {
662
+ if (auto r = rhs. isColorHSLA ( )) {
663
663
return h_ == r->h () &&
664
664
s_ == r->s () &&
665
665
l_ == r->l () &&
@@ -726,7 +726,7 @@ namespace Sass {
726
726
727
727
bool Custom_Error::operator == (const Value& rhs) const
728
728
{
729
- if (auto r = Cast<Custom_Error>(& rhs)) {
729
+ if (auto r = rhs. isError ( )) {
730
730
return message () == r->message ();
731
731
}
732
732
return false ;
@@ -741,7 +741,7 @@ namespace Sass {
741
741
742
742
bool Custom_Warning::operator == (const Value& rhs) const
743
743
{
744
- if (auto r = Cast<Custom_Warning>(& rhs)) {
744
+ if (auto r = rhs. isWarning ( )) {
745
745
return message () == r->message ();
746
746
}
747
747
return false ;
@@ -765,7 +765,7 @@ namespace Sass {
765
765
766
766
bool Boolean::operator == (const Value& rhs) const
767
767
{
768
- if (auto r = Cast<Boolean>(& rhs)) {
768
+ if (auto r = rhs. isBoolean ( )) {
769
769
return (value () == r->value ());
770
770
}
771
771
return false ;
@@ -794,10 +794,10 @@ namespace Sass {
794
794
795
795
const sass::string& Interpolation::getInitialPlain () const
796
796
{
797
- if (StringLiteral * str = Cast<StringLiteral>(first ())) {
797
+ if (StringLiteral * str = Cast<StringLiteral>(first ())) { // Ex
798
798
return str->text ();
799
799
}
800
- else if (String_Constant * str = Cast<String_Constant>(first ())) {
800
+ else if (String_Constant * str = Cast<String_Constant>(first ())) { // Ex
801
801
return str->value ();
802
802
}
803
803
return empty_string;
@@ -817,7 +817,7 @@ namespace Sass {
817
817
using namespace Character ;
818
818
bool containsDoubleQuote = false ;
819
819
for (auto item : text_->elements ()) {
820
- if (auto str = Cast<String_Constant>(item)) {
820
+ if (auto str = Cast<String_Constant>(item)) { // Ex
821
821
auto & value = str->value ();
822
822
for (size_t i = 0 ; i < value.size (); i++) {
823
823
uint8_t codeUnit = value[i];
@@ -854,7 +854,7 @@ namespace Sass {
854
854
855
855
for (auto value : text_->elements ()) {
856
856
// assert(value is Expression || value is String);
857
- if (StringLiteral * str = Cast<StringLiteral>(value)) {
857
+ if (StringLiteral * str = Cast<StringLiteral>(value)) { // Ex
858
858
sass::string value (str->text ());
859
859
for (size_t i = 0 ; i < value.size (); i++) {
860
860
@@ -885,11 +885,8 @@ namespace Sass {
885
885
886
886
}
887
887
}
888
- else if (Expression * ex = Cast<Expression>(value)) {
889
- buffer.add (ex);
890
- }
891
888
else {
892
- std::cerr << " nono item in schema \n " ;
889
+ buffer. add (value) ;
893
890
}
894
891
}
895
892
@@ -1095,7 +1092,7 @@ namespace Sass {
1095
1092
1096
1093
bool SassList::operator ==(const Value& rhs) const
1097
1094
{
1098
- if (const SassList* r = Cast<SassList>(& rhs)) {
1095
+ if (const SassList* r = rhs. isList ( )) {
1099
1096
if (length () != r->length ()) return false ;
1100
1097
if (separator () != r->separator ()) return false ;
1101
1098
if (hasBrackets () != r->hasBrackets ()) return false ;
@@ -1108,7 +1105,7 @@ namespace Sass {
1108
1105
}
1109
1106
return true ;
1110
1107
}
1111
- if (const Map * r = Cast<Map>(& rhs)) {
1108
+ if (const Map * r = rhs. isMap ( )) {
1112
1109
return empty () && r->empty ();
1113
1110
}
1114
1111
return false ;
@@ -1183,10 +1180,10 @@ namespace Sass {
1183
1180
1184
1181
bool SassArgumentList::operator ==(const Value& rhs) const
1185
1182
{
1186
- if (const SassList * r = Cast<SassList>(& rhs)) {
1183
+ if (const SassList * r = rhs. isList ( )) {
1187
1184
return SassList::operator ==(*r);
1188
1185
}
1189
- if (const Map * r = Cast<Map>(& rhs)) {
1186
+ if (const Map * r = rhs. isMap ( )) {
1190
1187
return SassList::operator ==(*r);
1191
1188
}
1192
1189
return false ;
@@ -1202,7 +1199,7 @@ namespace Sass {
1202
1199
1203
1200
bool SassFunction::operator == (const Value& rhs) const
1204
1201
{
1205
- if (const SassFunction* fn = Cast<SassFunction>(& rhs)) {
1202
+ if (const SassFunction* fn = rhs. isFunction ( )) {
1206
1203
return ObjEqualityFn (callable_, fn->callable ());
1207
1204
}
1208
1205
return false ;
0 commit comments