@@ -2215,6 +2215,7 @@ namespace Sass {
22152215 virtual ~Selector () = 0 ;
22162216 virtual size_t hash () = 0;
22172217 virtual unsigned long specificity () const = 0;
2218+ virtual int unification_order () const = 0;
22182219 virtual void set_media_block (Media_Block_Ptr mb) {
22192220 media_block (mb);
22202221 }
@@ -2394,6 +2395,10 @@ namespace Sass {
23942395 {
23952396 return 0 ;
23962397 }
2398+ int unification_order () const
2399+ {
2400+ throw std::runtime_error (" unification_order for Parent_Selector is undefined" );
2401+ }
23972402 std::string type () const { return " selector" ; }
23982403 static std::string type_name () { return " selector" ; }
23992404 ATTACH_AST_OPERATIONS (Parent_Selector)
@@ -2433,6 +2438,10 @@ namespace Sass {
24332438 {
24342439 return Constants::Specificity_Base;
24352440 }
2441+ int unification_order () const
2442+ {
2443+ return Constants::UnificationOrder_Placeholder;
2444+ }
24362445 virtual bool has_placeholder () {
24372446 return true ;
24382447 }
@@ -2457,6 +2466,10 @@ namespace Sass {
24572466 if (name () == " *" ) return 0 ;
24582467 else return Constants::Specificity_Element;
24592468 }
2469+ int unification_order () const
2470+ {
2471+ return Constants::UnificationOrder_Element;
2472+ }
24602473 virtual Simple_Selector_Ptr unify_with (Simple_Selector_Ptr);
24612474 virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
24622475 virtual bool operator ==(const Simple_Selector& rhs) const ;
@@ -2482,6 +2495,10 @@ namespace Sass {
24822495 {
24832496 return Constants::Specificity_Class;
24842497 }
2498+ int unification_order () const
2499+ {
2500+ return Constants::UnificationOrder_Class;
2501+ }
24852502 virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
24862503 ATTACH_AST_OPERATIONS (Class_Selector)
24872504 ATTACH_CRTP_PERFORM_METHODS ()
@@ -2502,6 +2519,10 @@ namespace Sass {
25022519 {
25032520 return Constants::Specificity_ID;
25042521 }
2522+ int unification_order () const
2523+ {
2524+ return Constants::UnificationOrder_Id;
2525+ }
25052526 virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
25062527 ATTACH_AST_OPERATIONS (Id_Selector)
25072528 ATTACH_CRTP_PERFORM_METHODS ()
@@ -2538,6 +2559,10 @@ namespace Sass {
25382559 {
25392560 return Constants::Specificity_Attr;
25402561 }
2562+ int unification_order () const
2563+ {
2564+ return Constants::UnificationOrder_Attribute;
2565+ }
25412566 virtual bool operator ==(const Simple_Selector& rhs) const ;
25422567 virtual bool operator ==(const Attribute_Selector& rhs) const ;
25432568 virtual bool operator <(const Simple_Selector& rhs) const ;
@@ -2599,6 +2624,12 @@ namespace Sass {
25992624 return Constants::Specificity_Element;
26002625 return Constants::Specificity_Pseudo;
26012626 }
2627+ int unification_order () const
2628+ {
2629+ if (is_pseudo_element ())
2630+ return Constants::UnificationOrder_PseudoElement;
2631+ return Constants::UnificationOrder_PseudoClass;
2632+ }
26022633 virtual bool operator ==(const Simple_Selector& rhs) const ;
26032634 virtual bool operator ==(const Pseudo_Selector& rhs) const ;
26042635 virtual bool operator <(const Simple_Selector& rhs) const ;
@@ -2627,6 +2658,10 @@ namespace Sass {
26272658 virtual bool has_parent_ref () const ;
26282659 virtual bool has_real_parent_ref () const ;
26292660 virtual unsigned long specificity () const ;
2661+ int unification_order () const
2662+ {
2663+ return Constants::UnificationOrder_Wrapped;
2664+ }
26302665 virtual bool find ( bool (*f)(AST_Node_Obj) );
26312666 virtual bool operator ==(const Simple_Selector& rhs) const ;
26322667 virtual bool operator ==(const Wrapped_Selector& rhs) const ;
@@ -2709,6 +2744,10 @@ namespace Sass {
27092744 { sum += (*this )[i]->specificity (); }
27102745 return sum;
27112746 }
2747+ int unification_order () const
2748+ {
2749+ throw std::runtime_error (" unification_order for Compound_Selector is undefined" );
2750+ }
27122751
27132752 virtual bool has_placeholder ()
27142753 {
@@ -2837,6 +2876,10 @@ namespace Sass {
28372876 if (tail ()) sum += tail ()->specificity ();
28382877 return sum;
28392878 }
2879+ int unification_order () const
2880+ {
2881+ throw std::runtime_error (" unification_order for Complex_Selector is undefined" );
2882+ }
28402883 virtual void set_media_block (Media_Block_Ptr mb) {
28412884 media_block (mb);
28422885 if (tail_) tail_->set_media_block (mb);
@@ -2960,6 +3003,10 @@ namespace Sass {
29603003 }
29613004 return sum;
29623005 }
3006+ int unification_order () const
3007+ {
3008+ throw std::runtime_error (" unification_order for Selector_List is undefined" );
3009+ }
29633010 virtual void set_media_block (Media_Block_Ptr mb) {
29643011 media_block (mb);
29653012 for (Complex_Selector_Obj cs : elements ()) {
0 commit comments