@@ -2215,6 +2215,7 @@ namespace Sass {
2215
2215
virtual ~Selector () = 0 ;
2216
2216
virtual size_t hash () = 0;
2217
2217
virtual unsigned long specificity () const = 0;
2218
+ virtual int unification_order () const = 0;
2218
2219
virtual void set_media_block (Media_Block_Ptr mb) {
2219
2220
media_block (mb);
2220
2221
}
@@ -2394,6 +2395,10 @@ namespace Sass {
2394
2395
{
2395
2396
return 0 ;
2396
2397
}
2398
+ int unification_order () const
2399
+ {
2400
+ throw std::runtime_error (" unification_order for Parent_Selector is undefined" );
2401
+ }
2397
2402
std::string type () const { return " selector" ; }
2398
2403
static std::string type_name () { return " selector" ; }
2399
2404
ATTACH_AST_OPERATIONS (Parent_Selector)
@@ -2433,6 +2438,10 @@ namespace Sass {
2433
2438
{
2434
2439
return Constants::Specificity_Base;
2435
2440
}
2441
+ int unification_order () const
2442
+ {
2443
+ return Constants::UnificationOrder_Placeholder;
2444
+ }
2436
2445
virtual bool has_placeholder () {
2437
2446
return true ;
2438
2447
}
@@ -2457,6 +2466,10 @@ namespace Sass {
2457
2466
if (name () == " *" ) return 0 ;
2458
2467
else return Constants::Specificity_Element;
2459
2468
}
2469
+ int unification_order () const
2470
+ {
2471
+ return Constants::UnificationOrder_Element;
2472
+ }
2460
2473
virtual Simple_Selector_Ptr unify_with (Simple_Selector_Ptr);
2461
2474
virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
2462
2475
virtual bool operator ==(const Simple_Selector& rhs) const ;
@@ -2482,6 +2495,10 @@ namespace Sass {
2482
2495
{
2483
2496
return Constants::Specificity_Class;
2484
2497
}
2498
+ int unification_order () const
2499
+ {
2500
+ return Constants::UnificationOrder_Class;
2501
+ }
2485
2502
virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
2486
2503
ATTACH_AST_OPERATIONS (Class_Selector)
2487
2504
ATTACH_CRTP_PERFORM_METHODS ()
@@ -2502,6 +2519,10 @@ namespace Sass {
2502
2519
{
2503
2520
return Constants::Specificity_ID;
2504
2521
}
2522
+ int unification_order () const
2523
+ {
2524
+ return Constants::UnificationOrder_Id;
2525
+ }
2505
2526
virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr);
2506
2527
ATTACH_AST_OPERATIONS (Id_Selector)
2507
2528
ATTACH_CRTP_PERFORM_METHODS ()
@@ -2538,6 +2559,10 @@ namespace Sass {
2538
2559
{
2539
2560
return Constants::Specificity_Attr;
2540
2561
}
2562
+ int unification_order () const
2563
+ {
2564
+ return Constants::UnificationOrder_Attribute;
2565
+ }
2541
2566
virtual bool operator ==(const Simple_Selector& rhs) const ;
2542
2567
virtual bool operator ==(const Attribute_Selector& rhs) const ;
2543
2568
virtual bool operator <(const Simple_Selector& rhs) const ;
@@ -2599,6 +2624,12 @@ namespace Sass {
2599
2624
return Constants::Specificity_Element;
2600
2625
return Constants::Specificity_Pseudo;
2601
2626
}
2627
+ int unification_order () const
2628
+ {
2629
+ if (is_pseudo_element ())
2630
+ return Constants::UnificationOrder_PseudoElement;
2631
+ return Constants::UnificationOrder_PseudoClass;
2632
+ }
2602
2633
virtual bool operator ==(const Simple_Selector& rhs) const ;
2603
2634
virtual bool operator ==(const Pseudo_Selector& rhs) const ;
2604
2635
virtual bool operator <(const Simple_Selector& rhs) const ;
@@ -2627,6 +2658,10 @@ namespace Sass {
2627
2658
virtual bool has_parent_ref () const ;
2628
2659
virtual bool has_real_parent_ref () const ;
2629
2660
virtual unsigned long specificity () const ;
2661
+ int unification_order () const
2662
+ {
2663
+ return Constants::UnificationOrder_Wrapped;
2664
+ }
2630
2665
virtual bool find ( bool (*f)(AST_Node_Obj) );
2631
2666
virtual bool operator ==(const Simple_Selector& rhs) const ;
2632
2667
virtual bool operator ==(const Wrapped_Selector& rhs) const ;
@@ -2709,6 +2744,10 @@ namespace Sass {
2709
2744
{ sum += (*this )[i]->specificity (); }
2710
2745
return sum;
2711
2746
}
2747
+ int unification_order () const
2748
+ {
2749
+ throw std::runtime_error (" unification_order for Compound_Selector is undefined" );
2750
+ }
2712
2751
2713
2752
virtual bool has_placeholder ()
2714
2753
{
@@ -2837,6 +2876,10 @@ namespace Sass {
2837
2876
if (tail ()) sum += tail ()->specificity ();
2838
2877
return sum;
2839
2878
}
2879
+ int unification_order () const
2880
+ {
2881
+ throw std::runtime_error (" unification_order for Complex_Selector is undefined" );
2882
+ }
2840
2883
virtual void set_media_block (Media_Block_Ptr mb) {
2841
2884
media_block (mb);
2842
2885
if (tail_) tail_->set_media_block (mb);
@@ -2960,6 +3003,10 @@ namespace Sass {
2960
3003
}
2961
3004
return sum;
2962
3005
}
3006
+ int unification_order () const
3007
+ {
3008
+ throw std::runtime_error (" unification_order for Selector_List is undefined" );
3009
+ }
2963
3010
virtual void set_media_block (Media_Block_Ptr mb) {
2964
3011
media_block (mb);
2965
3012
for (Complex_Selector_Obj cs : elements ()) {
0 commit comments