@@ -572,13 +572,15 @@ namespace Sass {
572572 // Trace.
573573 // ///////////////
574574 class Trace : public Has_Block {
575+ ADD_CONSTREF (char , type)
575576 ADD_CONSTREF (std::string, name)
576577 public:
577- Trace (ParserState pstate, std::string n, Block_Obj b = 0 )
578- : Has_Block(pstate, b), name_(n)
578+ Trace (ParserState pstate, std::string n, Block_Obj b = 0 , char type = ' m ' )
579+ : Has_Block(pstate, b), type_(type), name_(n)
579580 { }
580581 Trace (const Trace* ptr)
581582 : Has_Block(ptr),
583+ type_ (ptr->type_),
582584 name_(ptr->name_)
583585 { }
584586 ATTACH_AST_OPERATIONS (Trace)
@@ -943,7 +945,7 @@ namespace Sass {
943945 // ///////////////////////////////////////////////////////////////////////////
944946 struct Backtrace ;
945947 typedef const char * Signature;
946- typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtrace* , std::vector<Selector_List_Obj>);
948+ typedef Expression_Ptr (*Native_Function)(Env&, Env&, Context&, Signature, ParserState, Backtraces , std::vector<Selector_List_Obj>);
947949 class Definition : public Has_Block {
948950 public:
949951 enum Type { MIXIN, FUNCTION };
@@ -1184,6 +1186,27 @@ namespace Sass {
11841186 }
11851187 }
11861188
1189+ inline static const std::string sass_op_separator (enum Sass_OP op) {
1190+ switch (op) {
1191+ case AND: return " &&" ;
1192+ case OR: return " ||" ;
1193+ case EQ: return " ==" ;
1194+ case NEQ: return " !=" ;
1195+ case GT: return " >" ;
1196+ case GTE: return " >=" ;
1197+ case LT: return " <" ;
1198+ case LTE: return " <=" ;
1199+ case ADD: return " +" ;
1200+ case SUB: return " -" ;
1201+ case MUL: return " *" ;
1202+ case DIV: return " /" ;
1203+ case MOD: return " %" ;
1204+ // this is only used internally!
1205+ case NUM_OPS: return " [OPS]" ;
1206+ default : return " invalid" ;
1207+ }
1208+ }
1209+
11871210 // ////////////////////////////////////////////////////////////////////////
11881211 // Binary expressions. Represents logical, relational, and arithmetic
11891212 // operations. Templatized to avoid large switch statements and repetitive
@@ -1208,44 +1231,10 @@ namespace Sass {
12081231 hash_(ptr->hash_)
12091232 { }
12101233 const std::string type_name () {
1211- switch (optype ()) {
1212- case AND: return " and" ;
1213- case OR: return " or" ;
1214- case EQ: return " eq" ;
1215- case NEQ: return " neq" ;
1216- case GT: return " gt" ;
1217- case GTE: return " gte" ;
1218- case LT: return " lt" ;
1219- case LTE: return " lte" ;
1220- case ADD: return " add" ;
1221- case SUB: return " sub" ;
1222- case MUL: return " mul" ;
1223- case DIV: return " div" ;
1224- case MOD: return " mod" ;
1225- // this is only used internally!
1226- case NUM_OPS: return " [OPS]" ;
1227- default : return " invalid" ;
1228- }
1234+ return sass_op_to_name (optype ());
12291235 }
12301236 const std::string separator () {
1231- switch (optype ()) {
1232- case AND: return " &&" ;
1233- case OR: return " ||" ;
1234- case EQ: return " ==" ;
1235- case NEQ: return " !=" ;
1236- case GT: return " >" ;
1237- case GTE: return " >=" ;
1238- case LT: return " <" ;
1239- case LTE: return " <=" ;
1240- case ADD: return " +" ;
1241- case SUB: return " -" ;
1242- case MUL: return " *" ;
1243- case DIV: return " /" ;
1244- case MOD: return " %" ;
1245- // this is only used internally!
1246- case NUM_OPS: return " [OPS]" ;
1247- default : return " invalid" ;
1248- }
1237+ return sass_op_separator (optype ());
12491238 }
12501239 bool is_left_interpolant (void ) const ;
12511240 bool is_right_interpolant (void ) const ;
@@ -1360,7 +1349,7 @@ namespace Sass {
13601349 : Expression(pstate), value_(val), name_(n), is_rest_argument_(rest), is_keyword_argument_(keyword), hash_(0 )
13611350 {
13621351 if (!name_.empty () && is_rest_argument_) {
1363- error (" variable-length argument may not be passed by name" , pstate_);
1352+ coreError (" variable-length argument may not be passed by name" , pstate_);
13641353 }
13651354 }
13661355 Argument (const Argument* ptr)
@@ -1372,7 +1361,7 @@ namespace Sass {
13721361 hash_(ptr->hash_)
13731362 {
13741363 if (!name_.empty () && is_rest_argument_) {
1375- error (" variable-length argument may not be passed by name" , pstate_);
1364+ coreError (" variable-length argument may not be passed by name" , pstate_);
13761365 }
13771366 }
13781367
@@ -2218,22 +2207,22 @@ namespace Sass {
22182207 {
22192208 if (p->default_value ()) {
22202209 if (has_rest_parameter ()) {
2221- error (" optional parameters may not be combined with variable-length parameters" , p->pstate ());
2210+ coreError (" optional parameters may not be combined with variable-length parameters" , p->pstate ());
22222211 }
22232212 has_optional_parameters (true );
22242213 }
22252214 else if (p->is_rest_parameter ()) {
22262215 if (has_rest_parameter ()) {
2227- error (" functions and mixins cannot have more than one variable-length parameter" , p->pstate ());
2216+ coreError (" functions and mixins cannot have more than one variable-length parameter" , p->pstate ());
22282217 }
22292218 has_rest_parameter (true );
22302219 }
22312220 else {
22322221 if (has_rest_parameter ()) {
2233- error (" required parameters must precede variable-length parameters" , p->pstate ());
2222+ coreError (" required parameters must precede variable-length parameters" , p->pstate ());
22342223 }
22352224 if (has_optional_parameters ()) {
2236- error (" required parameters must precede optional parameters" , p->pstate ());
2225+ coreError (" required parameters must precede optional parameters" , p->pstate ());
22372226 }
22382227 }
22392228 }
@@ -2872,13 +2861,13 @@ namespace Sass {
28722861 Complex_Selector_Obj innermost () { return last (); };
28732862
28742863 size_t length () const ;
2875- Selector_List_Ptr resolve_parent_refs (std::vector<Selector_List_Obj>& pstack, bool implicit_parent = true );
2864+ Selector_List_Ptr resolve_parent_refs (std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent = true );
28762865 virtual bool is_superselector_of (Compound_Selector_Obj sub, std::string wrapping = " " );
28772866 virtual bool is_superselector_of (Complex_Selector_Obj sub, std::string wrapping = " " );
28782867 virtual bool is_superselector_of (Selector_List_Obj sub, std::string wrapping = " " );
28792868 Selector_List_Ptr unify_with (Complex_Selector_Ptr rhs);
28802869 Combinator clear_innermost ();
2881- void append (Complex_Selector_Obj);
2870+ void append (Complex_Selector_Obj, Backtraces& traces );
28822871 void set_innermost (Complex_Selector_Obj, Combinator);
28832872 virtual size_t hash ()
28842873 {
@@ -2994,7 +2983,7 @@ namespace Sass {
29942983 virtual bool has_parent_ref () const ;
29952984 virtual bool has_real_parent_ref () const ;
29962985 void remove_parent_selectors ();
2997- Selector_List_Ptr resolve_parent_refs (std::vector<Selector_List_Obj>& pstack, bool implicit_parent = true );
2986+ Selector_List_Ptr resolve_parent_refs (std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent = true );
29982987 virtual bool is_superselector_of (Compound_Selector_Obj sub, std::string wrapping = " " );
29992988 virtual bool is_superselector_of (Complex_Selector_Obj sub, std::string wrapping = " " );
30002989 virtual bool is_superselector_of (Selector_List_Obj sub, std::string wrapping = " " );
0 commit comments