@@ -209,6 +209,7 @@ namespace Sass {
209
209
210
210
bool Simple_Selector::operator == (const Simple_Selector& rhs) const
211
211
{
212
+ if (const Pseudo_Selector* lp = dynamic_cast <const Pseudo_Selector*>(this )) return *lp == rhs;
212
213
if (const Wrapped_Selector* lw = dynamic_cast <const Wrapped_Selector*>(this )) return *lw == rhs;
213
214
if (const Attribute_Selector* la = dynamic_cast <const Attribute_Selector*>(this )) return *la == rhs;
214
215
if (is_ns_eq (ns (), rhs.ns ()))
@@ -218,6 +219,7 @@ namespace Sass {
218
219
219
220
bool Simple_Selector::operator < (const Simple_Selector& rhs) const
220
221
{
222
+ if (const Pseudo_Selector* lp = dynamic_cast <const Pseudo_Selector*>(this )) return *lp == rhs;
221
223
if (const Wrapped_Selector* lw = dynamic_cast <const Wrapped_Selector*>(this )) return *lw < rhs;
222
224
if (const Attribute_Selector* la = dynamic_cast <const Attribute_Selector*>(this )) return *la < rhs;
223
225
if (is_ns_eq (ns (), rhs.ns ()))
@@ -481,6 +483,49 @@ namespace Sass {
481
483
return ns () == rhs.ns ();
482
484
}
483
485
486
+ bool Pseudo_Selector::operator == (const Pseudo_Selector& rhs) const
487
+ {
488
+ if (is_ns_eq (ns (), rhs.ns ()) && name () == rhs.name ())
489
+ {
490
+ Expression* lhs_ex = expression ();
491
+ Expression* rhs_ex = rhs.expression ();
492
+ if (rhs_ex && lhs_ex) return *lhs_ex == *rhs_ex;
493
+ else return lhs_ex == rhs_ex;
494
+ }
495
+ else return false ;
496
+ }
497
+
498
+ bool Pseudo_Selector::operator == (const Simple_Selector& rhs) const
499
+ {
500
+ if (const Pseudo_Selector* w = dynamic_cast <const Pseudo_Selector*>(&rhs))
501
+ {
502
+ return *this == *w;
503
+ }
504
+ if (is_ns_eq (ns (), rhs.ns ()))
505
+ { return name () == rhs.name (); }
506
+ return ns () == rhs.ns ();
507
+ }
508
+
509
+ bool Pseudo_Selector::operator < (const Pseudo_Selector& rhs) const
510
+ {
511
+ if (is_ns_eq (ns (), rhs.ns ()) && name () == rhs.name ())
512
+ { return *(expression ()) < *(rhs.expression ()); }
513
+ if (is_ns_eq (ns (), rhs.ns ()))
514
+ { return name () < rhs.name (); }
515
+ return ns () < rhs.ns ();
516
+ }
517
+
518
+ bool Pseudo_Selector::operator < (const Simple_Selector& rhs) const
519
+ {
520
+ if (const Pseudo_Selector* w = dynamic_cast <const Pseudo_Selector*>(&rhs))
521
+ {
522
+ return *this < *w;
523
+ }
524
+ if (is_ns_eq (ns (), rhs.ns ()))
525
+ { return name () < rhs.name (); }
526
+ return ns () < rhs.ns ();
527
+ }
528
+
484
529
bool Wrapped_Selector::operator == (const Wrapped_Selector& rhs) const
485
530
{
486
531
if (is_ns_eq (ns (), rhs.ns ()) && name () == rhs.name ())
0 commit comments