@@ -319,18 +319,18 @@ namespace Sass {
319
319
return ns () < rhs.ns ();
320
320
}
321
321
322
- bool Selector_List ::operator == (const Selector& rhs) const
322
+ bool CommaSequence_Selector ::operator == (const Selector& rhs) const
323
323
{
324
324
// solve the double dispatch problem by using RTTI information via dynamic cast
325
- if (const Selector_List * ls = dynamic_cast <const Selector_List *>(&rhs)) { return *this == *ls; }
325
+ if (const CommaSequence_Selector * ls = dynamic_cast <const CommaSequence_Selector *>(&rhs)) { return *this == *ls; }
326
326
else if (const Complex_Selector* ls = dynamic_cast <const Complex_Selector*>(&rhs)) { return *this == *ls; }
327
327
else if (const Compound_Selector* ls = dynamic_cast <const Compound_Selector*>(&rhs)) { return *this == *ls; }
328
328
// no compare method
329
329
return this == &rhs;
330
330
}
331
331
332
332
// Selector lists can be compared to comma lists
333
- bool Selector_List ::operator ==(const Expression& rhs) const
333
+ bool CommaSequence_Selector ::operator ==(const Expression& rhs) const
334
334
{
335
335
// solve the double dispatch problem by using RTTI information via dynamic cast
336
336
if (const List* ls = dynamic_cast <const List*>(&rhs)) { return *this == *ls; }
@@ -339,7 +339,7 @@ namespace Sass {
339
339
return false ;
340
340
}
341
341
342
- bool Selector_List ::operator == (const Selector_List & rhs) const
342
+ bool CommaSequence_Selector ::operator == (const CommaSequence_Selector & rhs) const
343
343
{
344
344
// for array access
345
345
size_t i = 0 , n = 0 ;
@@ -660,18 +660,18 @@ namespace Sass {
660
660
{
661
661
if (this ->name () != sub->name ()) return false ;
662
662
if (this ->name () == " :current" ) return false ;
663
- if (Selector_List * rhs_list = dynamic_cast <Selector_List *>(sub->selector ())) {
664
- if (Selector_List * lhs_list = dynamic_cast <Selector_List *>(selector ())) {
663
+ if (CommaSequence_Selector * rhs_list = dynamic_cast <CommaSequence_Selector *>(sub->selector ())) {
664
+ if (CommaSequence_Selector * lhs_list = dynamic_cast <CommaSequence_Selector *>(selector ())) {
665
665
return lhs_list->is_superselector_of (rhs_list);
666
666
}
667
- error (" is_superselector expected a Selector_List " , sub->pstate ());
667
+ error (" is_superselector expected a CommaSequence_Selector " , sub->pstate ());
668
668
} else {
669
- error (" is_superselector expected a Selector_List " , sub->pstate ());
669
+ error (" is_superselector expected a CommaSequence_Selector " , sub->pstate ());
670
670
}
671
671
return false ;
672
672
}
673
673
674
- bool Compound_Selector::is_superselector_of (Selector_List * rhs, std::string wrapped)
674
+ bool Compound_Selector::is_superselector_of (CommaSequence_Selector * rhs, std::string wrapped)
675
675
{
676
676
for (Complex_Selector* item : rhs->elements ()) {
677
677
if (is_superselector_of (item, wrapped)) return true ;
@@ -734,15 +734,15 @@ namespace Sass {
734
734
// very special case for wrapped matches selector
735
735
if (Wrapped_Selector* wrapped = dynamic_cast <Wrapped_Selector*>(lhs)) {
736
736
if (wrapped->name () == " :not" ) {
737
- if (Selector_List * not_list = dynamic_cast <Selector_List *>(wrapped->selector ())) {
737
+ if (CommaSequence_Selector * not_list = dynamic_cast <CommaSequence_Selector *>(wrapped->selector ())) {
738
738
if (not_list->is_superselector_of (rhs, wrapped->name ())) return false ;
739
739
} else {
740
740
throw std::runtime_error (" wrapped not selector is not a list" );
741
741
}
742
742
}
743
743
if (wrapped->name () == " :matches" || wrapped->name () == " :-moz-any" ) {
744
744
lhs = wrapped->selector ();
745
- if (Selector_List * list = dynamic_cast <Selector_List *>(wrapped->selector ())) {
745
+ if (CommaSequence_Selector * list = dynamic_cast <CommaSequence_Selector *>(wrapped->selector ())) {
746
746
if (Compound_Selector* comp = dynamic_cast <Compound_Selector*>(rhs)) {
747
747
if (!wrapping.empty () && wrapping != wrapped->name ()) return false ;
748
748
if (wrapping.empty () || wrapping != wrapped->name ()) {;
@@ -770,7 +770,7 @@ namespace Sass {
770
770
auto r = (*rhs)[n];
771
771
if (Wrapped_Selector* wrapped = dynamic_cast <Wrapped_Selector*>(r)) {
772
772
if (wrapped->name () == " :not" ) {
773
- if (Selector_List * ls = dynamic_cast <Selector_List *>(wrapped->selector ())) {
773
+ if (CommaSequence_Selector * ls = dynamic_cast <CommaSequence_Selector *>(wrapped->selector ())) {
774
774
ls->remove_parent_selectors ();
775
775
if (is_superselector_of (ls, wrapped->name ())) return false ;
776
776
}
@@ -779,7 +779,7 @@ namespace Sass {
779
779
if (!wrapping.empty ()) {
780
780
if (wrapping != wrapped->name ()) return false ;
781
781
}
782
- if (Selector_List * ls = dynamic_cast <Selector_List *>(wrapped->selector ())) {
782
+ if (CommaSequence_Selector * ls = dynamic_cast <CommaSequence_Selector *>(wrapped->selector ())) {
783
783
ls->remove_parent_selectors ();
784
784
return (is_superselector_of (ls, wrapped->name ()));
785
785
}
@@ -808,7 +808,7 @@ namespace Sass {
808
808
0 );
809
809
}
810
810
811
- Selector_List * Complex_Selector::unify_with (Complex_Selector* other, Context& ctx)
811
+ CommaSequence_Selector * Complex_Selector::unify_with (Complex_Selector* other, Context& ctx)
812
812
{
813
813
814
814
// get last tails (on the right side)
@@ -866,7 +866,7 @@ namespace Sass {
866
866
867
867
// do some magic we inherit from node and extend
868
868
Node node = Extend::subweave (lhsNode, rhsNode, ctx);
869
- Selector_List * result = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
869
+ CommaSequence_Selector * result = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
870
870
NodeDequePtr col = node.collection (); // move from collection to list
871
871
for (NodeDeque::iterator it = col->begin (), end = col->end (); it != end; it++)
872
872
{ (*result) << nodeToComplexSelector (Node::naiveTrim (*it, ctx), ctx); }
@@ -1084,12 +1084,12 @@ namespace Sass {
1084
1084
1085
1085
}
1086
1086
1087
- Selector_List* Selector_List ::resolve_parent_refs (Context& ctx, Selector_List * ps, bool implicit_parent)
1087
+ CommaSequence_Selector* CommaSequence_Selector ::resolve_parent_refs (Context& ctx, CommaSequence_Selector * ps, bool implicit_parent)
1088
1088
{
1089
1089
if (!this ->has_parent_ref ()/* && !implicit_parent*/ ) return this ;
1090
- Selector_List * ss = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
1090
+ CommaSequence_Selector * ss = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
1091
1091
for (size_t pi = 0 , pL = ps->length (); pi < pL; ++pi) {
1092
- Selector_List * list = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
1092
+ CommaSequence_Selector * list = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
1093
1093
*list << (*ps)[pi];
1094
1094
for (size_t si = 0 , sL = this ->length (); si < sL ; ++si) {
1095
1095
*ss += (*this )[si]->resolve_parent_refs (ctx, list, implicit_parent);
@@ -1098,21 +1098,21 @@ namespace Sass {
1098
1098
return ss;
1099
1099
}
1100
1100
1101
- Selector_List * Complex_Selector::resolve_parent_refs (Context& ctx, Selector_List * parents, bool implicit_parent)
1101
+ CommaSequence_Selector * Complex_Selector::resolve_parent_refs (Context& ctx, CommaSequence_Selector * parents, bool implicit_parent)
1102
1102
{
1103
1103
Complex_Selector* tail = this ->tail ();
1104
1104
Compound_Selector* head = this ->head ();
1105
1105
1106
1106
// first resolve_parent_refs the tail (which may return an expanded list)
1107
- Selector_List * tails = tail ? tail->resolve_parent_refs (ctx, parents, implicit_parent) : 0 ;
1107
+ CommaSequence_Selector * tails = tail ? tail->resolve_parent_refs (ctx, parents, implicit_parent) : 0 ;
1108
1108
1109
1109
if (head && head->length () > 0 ) {
1110
1110
1111
- Selector_List * retval = 0 ;
1111
+ CommaSequence_Selector * retval = 0 ;
1112
1112
// we have a parent selector in a simple compound list
1113
1113
// mix parent complex selector into the compound list
1114
1114
if (dynamic_cast <Parent_Selector*>((*head)[0 ])) {
1115
- retval = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
1115
+ retval = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
1116
1116
if (parents && parents->length ()) {
1117
1117
if (tails && tails->length () > 0 ) {
1118
1118
for (size_t n = 0 , nL = tails->length (); n < nL; ++n) {
@@ -1184,7 +1184,7 @@ namespace Sass {
1184
1184
1185
1185
for (Simple_Selector* ss : *head) {
1186
1186
if (Wrapped_Selector* ws = dynamic_cast <Wrapped_Selector*>(ss)) {
1187
- if (Selector_List * sl = dynamic_cast <Selector_List *>(ws->selector ())) {
1187
+ if (CommaSequence_Selector * sl = dynamic_cast <CommaSequence_Selector *>(ws->selector ())) {
1188
1188
if (parents) ws->selector (sl->resolve_parent_refs (ctx, parents, implicit_parent));
1189
1189
}
1190
1190
}
@@ -1202,9 +1202,9 @@ namespace Sass {
1202
1202
return 0 ;
1203
1203
}
1204
1204
1205
- Selector_List * Complex_Selector::tails (Context& ctx, Selector_List * tails)
1205
+ CommaSequence_Selector * Complex_Selector::tails (Context& ctx, CommaSequence_Selector * tails)
1206
1206
{
1207
- Selector_List * rv = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate_);
1207
+ CommaSequence_Selector * rv = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate_);
1208
1208
if (tails && tails->length ()) {
1209
1209
for (size_t i = 0 , iL = tails->length (); i < iL; ++i) {
1210
1210
Complex_Selector* pr = this ->clone (ctx);
@@ -1331,17 +1331,17 @@ namespace Sass {
1331
1331
return cpy;
1332
1332
}
1333
1333
1334
- Selector_List* Selector_List ::clone (Context& ctx) const
1334
+ CommaSequence_Selector* CommaSequence_Selector ::clone (Context& ctx) const
1335
1335
{
1336
- Selector_List * cpy = SASS_MEMORY_NEW (ctx.mem , Selector_List , *this );
1336
+ CommaSequence_Selector * cpy = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , *this );
1337
1337
cpy->is_optional (this ->is_optional ());
1338
1338
cpy->media_block (this ->media_block ());
1339
1339
return cpy;
1340
1340
}
1341
1341
1342
- Selector_List* Selector_List ::cloneFully (Context& ctx) const
1342
+ CommaSequence_Selector* CommaSequence_Selector ::cloneFully (Context& ctx) const
1343
1343
{
1344
- Selector_List * cpy = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
1344
+ CommaSequence_Selector * cpy = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
1345
1345
cpy->is_optional (this ->is_optional ());
1346
1346
cpy->media_block (this ->media_block ());
1347
1347
for (size_t i = 0 , L = length (); i < L; ++i) {
@@ -1358,7 +1358,7 @@ namespace Sass {
1358
1358
1359
1359
// remove parent selector references
1360
1360
// basically unwraps parsed selectors
1361
- void Selector_List ::remove_parent_selectors ()
1361
+ void CommaSequence_Selector ::remove_parent_selectors ()
1362
1362
{
1363
1363
// Check every rhs selector against left hand list
1364
1364
for (size_t i = 0 , L = length (); i < L; ++i) {
@@ -1381,7 +1381,7 @@ namespace Sass {
1381
1381
}
1382
1382
}
1383
1383
1384
- bool Selector_List ::has_parent_ref ()
1384
+ bool CommaSequence_Selector ::has_parent_ref ()
1385
1385
{
1386
1386
for (Complex_Selector* s : *this ) {
1387
1387
if (s && s->has_parent_ref ()) return true ;
@@ -1397,14 +1397,14 @@ namespace Sass {
1397
1397
return false ;
1398
1398
}
1399
1399
1400
- void Selector_List ::adjust_after_pushing (Complex_Selector* c)
1400
+ void CommaSequence_Selector ::adjust_after_pushing (Complex_Selector* c)
1401
1401
{
1402
1402
// if (c->has_reference()) has_reference(true);
1403
1403
}
1404
1404
1405
1405
// it's a superselector if every selector of the right side
1406
1406
// list is a superselector of the given left side selector
1407
- bool Complex_Selector::is_superselector_of (Selector_List *sub, std::string wrapping)
1407
+ bool Complex_Selector::is_superselector_of (CommaSequence_Selector *sub, std::string wrapping)
1408
1408
{
1409
1409
// Check every rhs selector against left hand list
1410
1410
for (size_t i = 0 , L = sub->length (); i < L; ++i) {
@@ -1415,7 +1415,7 @@ namespace Sass {
1415
1415
1416
1416
// it's a superselector if every selector of the right side
1417
1417
// list is a superselector of the given left side selector
1418
- bool Selector_List ::is_superselector_of (Selector_List *sub, std::string wrapping)
1418
+ bool CommaSequence_Selector ::is_superselector_of (CommaSequence_Selector *sub, std::string wrapping)
1419
1419
{
1420
1420
// Check every rhs selector against left hand list
1421
1421
for (size_t i = 0 , L = sub->length (); i < L; ++i) {
@@ -1426,7 +1426,7 @@ namespace Sass {
1426
1426
1427
1427
// it's a superselector if every selector on the right side
1428
1428
// is a superselector of any one of the left side selectors
1429
- bool Selector_List ::is_superselector_of (Compound_Selector *sub, std::string wrapping)
1429
+ bool CommaSequence_Selector ::is_superselector_of (Compound_Selector *sub, std::string wrapping)
1430
1430
{
1431
1431
// Check every lhs selector against right hand
1432
1432
for (size_t i = 0 , L = length (); i < L; ++i) {
@@ -1437,7 +1437,7 @@ namespace Sass {
1437
1437
1438
1438
// it's a superselector if every selector on the right side
1439
1439
// is a superselector of any one of the left side selectors
1440
- bool Selector_List ::is_superselector_of (Complex_Selector *sub, std::string wrapping)
1440
+ bool CommaSequence_Selector ::is_superselector_of (Complex_Selector *sub, std::string wrapping)
1441
1441
{
1442
1442
// Check every lhs selector against right hand
1443
1443
for (size_t i = 0 , L = length (); i < L; ++i) {
@@ -1446,15 +1446,15 @@ namespace Sass {
1446
1446
return false ;
1447
1447
}
1448
1448
1449
- Selector_List* Selector_List ::unify_with (Selector_List * rhs, Context& ctx) {
1449
+ CommaSequence_Selector* CommaSequence_Selector ::unify_with (CommaSequence_Selector * rhs, Context& ctx) {
1450
1450
std::vector<Complex_Selector*> unified_complex_selectors;
1451
1451
// Unify all of children with RHS's children, storing the results in `unified_complex_selectors`
1452
1452
for (size_t lhs_i = 0 , lhs_L = length (); lhs_i < lhs_L; ++lhs_i) {
1453
1453
Complex_Selector* seq1 = (*this )[lhs_i];
1454
1454
for (size_t rhs_i = 0 , rhs_L = rhs->length (); rhs_i < rhs_L; ++rhs_i) {
1455
1455
Complex_Selector* seq2 = (*rhs)[rhs_i];
1456
1456
1457
- Selector_List * result = seq1->unify_with (seq2, ctx);
1457
+ CommaSequence_Selector * result = seq1->unify_with (seq2, ctx);
1458
1458
if ( result ) {
1459
1459
for (size_t i = 0 , L = result->length (); i < L; ++i) {
1460
1460
unified_complex_selectors.push_back ( (*result)[i] );
@@ -1463,18 +1463,18 @@ namespace Sass {
1463
1463
}
1464
1464
}
1465
1465
1466
- // Creates the final Selector_List by combining all the complex selectors
1467
- Selector_List * final_result = SASS_MEMORY_NEW (ctx.mem , Selector_List , pstate ());
1466
+ // Creates the final CommaSequence_Selector by combining all the complex selectors
1467
+ CommaSequence_Selector * final_result = SASS_MEMORY_NEW (ctx.mem , CommaSequence_Selector , pstate ());
1468
1468
for (auto itr = unified_complex_selectors.begin (); itr != unified_complex_selectors.end (); ++itr) {
1469
1469
*final_result << *itr;
1470
1470
}
1471
1471
return final_result;
1472
1472
}
1473
1473
1474
- void Selector_List ::populate_extends (Selector_List * extendee, Context& ctx, ExtensionSubsetMap& extends)
1474
+ void CommaSequence_Selector ::populate_extends (CommaSequence_Selector * extendee, Context& ctx, ExtensionSubsetMap& extends)
1475
1475
{
1476
1476
1477
- Selector_List * extender = this ;
1477
+ CommaSequence_Selector * extender = this ;
1478
1478
for (auto complex_sel : extendee->elements ()) {
1479
1479
Complex_Selector* c = complex_sel;
1480
1480
@@ -1608,7 +1608,7 @@ namespace Sass {
1608
1608
}
1609
1609
1610
1610
bool Ruleset::is_invisible () const {
1611
- Selector_List * sl = static_cast <Selector_List *>(selector ());
1611
+ CommaSequence_Selector * sl = static_cast <CommaSequence_Selector *>(selector ());
1612
1612
for (size_t i = 0 , L = sl->length (); i < L; ++i)
1613
1613
if (!(*sl)[i]->has_placeholder ()) return false ;
1614
1614
return true ;
0 commit comments