@@ -201,7 +201,7 @@ namespace Sass {
201201 { }
202202 virtual operator bool () { return true ; }
203203 virtual ~Expression () { }
204- virtual std::string type () { return " " ; /* TODO: raise an error? */ }
204+ virtual std::string type () const { return " " ; /* TODO: raise an error? */ }
205205 virtual bool is_invisible () const { return false ; }
206206 static std::string type_name () { return " " ; }
207207 virtual bool is_false () { return false ; }
@@ -1073,7 +1073,7 @@ namespace Sass {
10731073 is_bracketed_(ptr->is_bracketed_),
10741074 from_selector_(ptr->from_selector_)
10751075 { concrete_type (LIST); }
1076- std::string type () { return is_arglist_ ? " arglist" : " list" ; }
1076+ std::string type () const { return is_arglist_ ? " arglist" : " list" ; }
10771077 static std::string type_name () { return " list" ; }
10781078 const char * sep_string (bool compressed = false ) const {
10791079 return separator () == SASS_SPACE ?
@@ -1122,7 +1122,7 @@ namespace Sass {
11221122 : Value(ptr),
11231123 Hashed(*ptr)
11241124 { concrete_type (MAP); }
1125- std::string type () { return " map" ; }
1125+ std::string type () const { return " map" ; }
11261126 static std::string type_name () { return " map" ; }
11271127 bool is_invisible () const { return empty (); }
11281128 List_Obj to_list (Context& ctx, ParserState& pstate);
@@ -1190,7 +1190,7 @@ namespace Sass {
11901190 hash_(ptr->hash_)
11911191 { }
11921192 const std::string type_name () {
1193- switch (type ()) {
1193+ switch (optype ()) {
11941194 case AND: return " and" ; break ;
11951195 case OR: return " or" ; break ;
11961196 case EQ: return " eq" ; break ;
@@ -1210,7 +1210,7 @@ namespace Sass {
12101210 }
12111211 }
12121212 const std::string separator () {
1213- switch (type ()) {
1213+ switch (optype ()) {
12141214 case AND: return " &&" ; break ;
12151215 case OR: return " ||" ; break ;
12161216 case EQ: return " ==" ; break ;
@@ -1261,13 +1261,13 @@ namespace Sass {
12611261 virtual size_t hash ()
12621262 {
12631263 if (hash_ == 0 ) {
1264- hash_ = std::hash<size_t >()(type ());
1264+ hash_ = std::hash<size_t >()(optype ());
12651265 hash_combine (hash_, left ()->hash ());
12661266 hash_combine (hash_, right ()->hash ());
12671267 }
12681268 return hash_;
12691269 }
1270- enum Sass_OP type () const { return op_.operand ; }
1270+ enum Sass_OP optype () const { return op_.operand ; }
12711271 ATTACH_AST_OPERATIONS (Binary_Expression)
12721272 ATTACH_OPERATIONS ()
12731273 };
@@ -1279,21 +1279,21 @@ namespace Sass {
12791279 public:
12801280 enum Type { PLUS, MINUS, NOT };
12811281 private:
1282- HASH_PROPERTY (Type, type )
1282+ HASH_PROPERTY (Type, optype )
12831283 HASH_PROPERTY (Expression_Obj, operand)
12841284 size_t hash_;
12851285 public:
12861286 Unary_Expression (ParserState pstate, Type t, Expression_Obj o)
1287- : Expression(pstate), type_ (t), operand_(o), hash_(0 )
1287+ : Expression(pstate), optype_ (t), operand_(o), hash_(0 )
12881288 { }
12891289 Unary_Expression (const Unary_Expression* ptr)
12901290 : Expression(ptr),
1291- type_ (ptr->type_ ),
1291+ optype_ (ptr->optype_ ),
12921292 operand_(ptr->operand_),
12931293 hash_(ptr->hash_)
12941294 { }
12951295 const std::string type_name () {
1296- switch (type_ ) {
1296+ switch (optype_ ) {
12971297 case PLUS: return " plus" ; break ;
12981298 case MINUS: return " minus" ; break ;
12991299 case NOT: return " not" ; break ;
@@ -1318,7 +1318,7 @@ namespace Sass {
13181318 virtual size_t hash ()
13191319 {
13201320 if (hash_ == 0 ) {
1321- hash_ = std::hash<size_t >()(type_ );
1321+ hash_ = std::hash<size_t >()(optype_ );
13221322 hash_combine (hash_, operand ()->hash ());
13231323 };
13241324 return hash_;
@@ -1541,17 +1541,17 @@ namespace Sass {
15411541 public:
15421542 enum Type { NUMBER, PERCENTAGE, DIMENSION, HEX };
15431543 private:
1544- HASH_PROPERTY (Type, type )
1544+ HASH_PROPERTY (Type, valtype )
15451545 HASH_CONSTREF (std::string, value)
15461546 size_t hash_;
15471547 public:
15481548 Textual (ParserState pstate, Type t, std::string val)
1549- : Expression(pstate, DELAYED), type_ (t), value_(val),
1549+ : Expression(pstate, DELAYED), valtype_ (t), value_(val),
15501550 hash_ (0 )
15511551 { }
15521552 Textual (const Textual* ptr)
15531553 : Expression(ptr),
1554- type_ (ptr->type_ ),
1554+ valtype_ (ptr->valtype_ ),
15551555 value_(ptr->value_),
15561556 hash_(ptr->hash_)
15571557 { }
@@ -1574,7 +1574,7 @@ namespace Sass {
15741574 {
15751575 if (hash_ == 0 ) {
15761576 hash_ = std::hash<std::string>()(value_);
1577- hash_combine (hash_, std::hash<int >()(type_ ));
1577+ hash_combine (hash_, std::hash<int >()(valtype_ ));
15781578 }
15791579 return hash_;
15801580 }
@@ -1609,7 +1609,7 @@ namespace Sass {
16091609 std::vector<std::string>& denominator_units () { return denominator_units_; }
16101610 const std::vector<std::string>& numerator_units () const { return numerator_units_; }
16111611 const std::vector<std::string>& denominator_units () const { return denominator_units_; }
1612- std::string type () { return " number" ; }
1612+ std::string type () const { return " number" ; }
16131613 static std::string type_name () { return " number" ; }
16141614 std::string unit () const ;
16151615
@@ -1662,7 +1662,7 @@ namespace Sass {
16621662 disp_(ptr->disp_),
16631663 hash_(ptr->hash_)
16641664 { concrete_type (COLOR); }
1665- std::string type () { return " color" ; }
1665+ std::string type () const { return " color" ; }
16661666 static std::string type_name () { return " color" ; }
16671667
16681668 virtual size_t hash ()
@@ -1733,7 +1733,7 @@ namespace Sass {
17331733 hash_(ptr->hash_)
17341734 { concrete_type (BOOLEAN); }
17351735 virtual operator bool () { return value_; }
1736- std::string type () { return " bool" ; }
1736+ std::string type () const { return " bool" ; }
17371737 static std::string type_name () { return " bool" ; }
17381738 virtual bool is_false () { return !value_; }
17391739
@@ -1792,7 +1792,7 @@ namespace Sass {
17921792 hash_ (ptr->hash_)
17931793 { concrete_type (STRING); }
17941794
1795- std::string type () { return " string" ; }
1795+ std::string type () const { return " string" ; }
17961796 static std::string type_name () { return " string" ; }
17971797
17981798 bool is_left_interpolant (void ) const ;
@@ -1853,7 +1853,7 @@ namespace Sass {
18531853 String_Constant (ParserState pstate, const Token& tok)
18541854 : String(pstate), quote_mark_(0 ), can_compress_whitespace_(false ), value_(read_css_string(std::string(tok.begin, tok.end))), hash_(0 )
18551855 { }
1856- std::string type () { return " string" ; }
1856+ std::string type () const { return " string" ; }
18571857 static std::string type_name () { return " string" ; }
18581858 virtual bool is_invisible () const ;
18591859 virtual void rtrim ();
@@ -2142,7 +2142,7 @@ namespace Sass {
21422142 public:
21432143 Null (ParserState pstate) : Value(pstate) { concrete_type (NULL_VAL); }
21442144 Null (const Null* ptr) : Value(ptr) { concrete_type (NULL_VAL); }
2145- std::string type () { return " null" ; }
2145+ std::string type () const { return " null" ; }
21462146 static std::string type_name () { return " null" ; }
21472147 bool is_invisible () const { return true ; }
21482148 operator bool () { return false ; }
@@ -2296,10 +2296,10 @@ namespace Sass {
22962296 virtual void set_media_block (Media_Block_Ptr mb) {
22972297 media_block (mb);
22982298 }
2299- virtual bool has_parent_ref () {
2299+ virtual bool has_parent_ref () const {
23002300 return false ;
23012301 }
2302- virtual bool has_real_parent_ref () {
2302+ virtual bool has_real_parent_ref () const {
23032303 return false ;
23042304 }
23052305 // dispatch to correct handlers
@@ -2334,8 +2334,8 @@ namespace Sass {
23342334 connect_parent_(ptr->connect_parent_),
23352335 media_block_(ptr->media_block_)
23362336 { }
2337- virtual bool has_parent_ref ();
2338- virtual bool has_real_parent_ref ();
2337+ virtual bool has_parent_ref () const ;
2338+ virtual bool has_real_parent_ref () const ;
23392339 virtual bool operator <(const Selector& rhs) const ;
23402340 virtual bool operator ==(const Selector& rhs) const ;
23412341 // selector schema is not yet a final selector, so we do not
@@ -2429,8 +2429,8 @@ namespace Sass {
24292429
24302430 virtual ~Simple_Selector () = 0 ;
24312431 virtual Compound_Selector_Ptr unify_with (Compound_Selector_Ptr, Context&);
2432- virtual bool has_parent_ref () { return false ; };
2433- virtual bool has_real_parent_ref () { return false ; };
2432+ virtual bool has_parent_ref () const { return false ; };
2433+ virtual bool has_real_parent_ref () const { return false ; };
24342434 virtual bool is_pseudo_element () const { return false ; }
24352435
24362436 virtual bool is_superselector_of (Compound_Selector_Obj sub) { return false ; }
@@ -2463,14 +2463,14 @@ namespace Sass {
24632463 Parent_Selector (const Parent_Selector* ptr)
24642464 : Simple_Selector(ptr), real_(ptr->real_)
24652465 { /* has_reference(true); */ }
2466- bool is_real_parent_ref () { return real (); };
2467- virtual bool has_parent_ref () { return true ; };
2468- virtual bool has_real_parent_ref () { return is_real_parent_ref (); };
2466+ bool is_real_parent_ref () const { return real (); };
2467+ virtual bool has_parent_ref () const { return true ; };
2468+ virtual bool has_real_parent_ref () const { return is_real_parent_ref (); };
24692469 virtual unsigned long specificity () const
24702470 {
24712471 return 0 ;
24722472 }
2473- std::string type () { return " selector" ; }
2473+ std::string type () const { return " selector" ; }
24742474 static std::string type_name () { return " selector" ; }
24752475 ATTACH_AST_OPERATIONS (Parent_Selector)
24762476 ATTACH_OPERATIONS ()
@@ -2676,8 +2676,8 @@ namespace Sass {
26762676 // Selectors inside the negation pseudo-class are counted like any
26772677 // other, but the negation itself does not count as a pseudo-class.
26782678 virtual size_t hash ();
2679- virtual bool has_parent_ref ();
2680- virtual bool has_real_parent_ref ();
2679+ virtual bool has_parent_ref () const ;
2680+ virtual bool has_real_parent_ref () const ;
26812681 virtual unsigned long specificity () const ;
26822682 virtual bool operator ==(const Simple_Selector& rhs) const ;
26832683 virtual bool operator ==(const Wrapped_Selector& rhs) const ;
@@ -2733,8 +2733,8 @@ namespace Sass {
27332733 Complex_Selector_Obj to_complex ();
27342734 Compound_Selector_Ptr unify_with (Compound_Selector_Ptr rhs, Context& ctx);
27352735 // virtual Placeholder_Selector_Ptr find_placeholder();
2736- virtual bool has_parent_ref ();
2737- virtual bool has_real_parent_ref ();
2736+ virtual bool has_parent_ref () const ;
2737+ virtual bool has_real_parent_ref () const ;
27382738 Simple_Selector_Ptr base () const {
27392739 if (length () == 0 ) return 0 ;
27402740 // ToDo: why is this needed?
@@ -2827,8 +2827,8 @@ namespace Sass {
28272827 head_(ptr->head_), tail_(ptr->tail_),
28282828 reference_(ptr->reference_)
28292829 {};
2830- virtual bool has_parent_ref ();
2831- virtual bool has_real_parent_ref ();
2830+ virtual bool has_parent_ref () const ;
2831+ virtual bool has_real_parent_ref () const ;
28322832
28332833 Complex_Selector_Obj skip_empty_reference ()
28342834 {
@@ -2977,11 +2977,11 @@ namespace Sass {
29772977 schema_(ptr->schema_),
29782978 wspace_(ptr->wspace_)
29792979 { }
2980- std::string type () { return " list" ; }
2980+ std::string type () const { return " list" ; }
29812981 // remove parent selector references
29822982 // basically unwraps parsed selectors
2983- virtual bool has_parent_ref ();
2984- virtual bool has_real_parent_ref ();
2983+ virtual bool has_parent_ref () const ;
2984+ virtual bool has_real_parent_ref () const ;
29852985 void remove_parent_selectors ();
29862986 Selector_List_Ptr resolve_parent_refs (Context& ctx, std::vector<Selector_List_Obj>& pstack, bool implicit_parent = true );
29872987 virtual bool is_superselector_of (Compound_Selector_Obj sub, std::string wrapping = " " );
0 commit comments