@@ -307,18 +307,63 @@ namespace Sass {
307
307
return unified.detach ();
308
308
}
309
309
310
- bool Selector ::operator == (const Selector& rhs) const
310
+ bool Complex_Selector ::operator == (const Selector& rhs) const
311
311
{
312
- if (const Selector_List* sl = Cast<Selector_List>(this )) return *sl == rhs;
313
- if (Simple_Selector_Ptr_Const sp = Cast<Simple_Selector>(this )) return *sp == rhs;
312
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
313
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
314
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
315
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
314
316
throw std::runtime_error (" invalid selector base classes to compare" );
315
317
return false ;
316
318
}
317
319
318
- bool Selector::operator < (const Selector& rhs) const
320
+
321
+ bool Complex_Selector::operator < (const Selector& rhs) const
322
+ {
323
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
324
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
325
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
326
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
327
+ throw std::runtime_error (" invalid selector base classes to compare" );
328
+ return false ;
329
+ }
330
+
331
+ bool Compound_Selector::operator == (const Selector& rhs) const
332
+ {
333
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
334
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
335
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
336
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
337
+ throw std::runtime_error (" invalid selector base classes to compare" );
338
+ return false ;
339
+ }
340
+
341
+ bool Compound_Selector::operator < (const Selector& rhs) const
342
+ {
343
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
344
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
345
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
346
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
347
+ throw std::runtime_error (" invalid selector base classes to compare" );
348
+ return false ;
349
+ }
350
+
351
+ bool Selector_Schema::operator == (const Selector& rhs) const
352
+ {
353
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
354
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
355
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
356
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
357
+ throw std::runtime_error (" invalid selector base classes to compare" );
358
+ return false ;
359
+ }
360
+
361
+ bool Selector_Schema::operator < (const Selector& rhs) const
319
362
{
320
- if (Selector_List_Ptr_Const sl = Cast<Selector_List>(this )) return *sl < rhs;
321
- if (Simple_Selector_Ptr_Const sp = Cast<Simple_Selector>(this )) return *sp < rhs;
363
+ if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
364
+ if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
365
+ if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
366
+ if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
322
367
throw std::runtime_error (" invalid selector base classes to compare" );
323
368
return false ;
324
369
}
0 commit comments