@@ -23,6 +23,7 @@ namespace Sass {
2323 case MUL: return 6 ;
2424 case DIV: return 6 ;
2525 case MOD: return 6 ;
26+ case IESEQ: return 9 ;
2627 // this is only used internally!
2728 case NUM_OPS: return 99 ;
2829 default : return 255 ;
@@ -44,7 +45,8 @@ namespace Sass {
4445 case MUL: return " times" ;
4546 case DIV: return " div" ;
4647 case MOD: return " mod" ;
47- // this is only used internally!
48+ case IESEQ: return " seq" ;
49+ // this is only used internally!
4850 case NUM_OPS: return " [OPS]" ;
4951 default : return " invalid" ;
5052 }
@@ -65,6 +67,7 @@ namespace Sass {
6567 if (op == " *" ) return MUL;
6668 if (op == " /" ) return DIV;
6769 if (op == " &" ) return MOD;
70+ if (op == " =" ) return IESEQ;
6871 return NUM_OPS;
6972 }
7073
@@ -83,7 +86,8 @@ namespace Sass {
8386 case MUL: return " *" ;
8487 case DIV: return " /" ;
8588 case MOD: return " %" ;
86- // this is only used internally!
89+ case IESEQ: return " =" ;
90+ // this is only used internally!
8791 case NUM_OPS: return " [OPS]" ;
8892 default : return " invalid" ;
8993 }
@@ -114,6 +118,7 @@ namespace Sass {
114118 Sass_Output_Options out (opt);
115119 Emitter emitter (out);
116120 Inspect i (emitter);
121+ i.quotes = false ;
117122 i.in_declaration = true ;
118123 // ToDo: inspect should be const
119124 const_cast <AST_Node*>(this )->perform (&i);
@@ -125,6 +130,11 @@ namespace Sass {
125130 return to_string ({ NESTED, 5 });
126131 }
127132
133+ std::string AST_Node::to_css () const
134+ {
135+ return to_css ({ NESTED, 5 });
136+ }
137+
128138 // ///////////////////////////////////////////////////////////////////////
129139 // ///////////////////////////////////////////////////////////////////////
130140
@@ -211,7 +221,7 @@ namespace Sass {
211221 : Has_Block(pstate, b), selector_(s), schema_(), is_root_(false )
212222 { statement_type (RULESET); }
213223
214- Ruleset::Ruleset (ParserState pstate, Selector_Schema * s, Block_Obj b)
224+ Ruleset::Ruleset (ParserState pstate, Interpolation2 * s, Block_Obj b)
215225 : Has_Block(pstate, b), selector_(), schema_(s), is_root_(false )
216226 { statement_type (RULESET); }
217227
@@ -223,11 +233,24 @@ namespace Sass {
223233 { statement_type (RULESET); }
224234
225235 bool Ruleset::is_invisible () const {
236+ bool sel_invisible = true ;
237+ bool els_invisible = true ;
226238 if (const SelectorList * sl = Cast<SelectorList>(selector ())) {
227- for (size_t i = 0 , L = sl->length (); i < L; i += 1 )
228- if (!(*sl)[i]->isInvisible ()) return false ;
239+ for (size_t i = 0 , L = sl->length (); i < L; i += 1 ) {
240+ if (!(*sl)[i]->isInvisible ()) {
241+ sel_invisible = false ;
242+ break ;
243+ }
244+ }
229245 }
230- return true ;
246+ for (Statement* item : block ()->elements ()) {
247+ if (!item->is_invisible ()) {
248+ els_invisible = false ;
249+ break ;
250+ }
251+ }
252+
253+ return sel_invisible || els_invisible;
231254 }
232255
233256 // ///////////////////////////////////////////////////////////////////////
@@ -263,14 +286,24 @@ namespace Sass {
263286 // ///////////////////////////////////////////////////////////////////////
264287
265288 Directive::Directive (ParserState pstate, std::string kwd, SelectorListObj sel, Block_Obj b, Expression_Obj val)
266- : Has_Block(pstate, b), keyword_(kwd), selector_(sel), selSchema_(), value_(val) // set value manually if needed
289+ : Has_Block(pstate, b), keyword_(kwd), selector_(sel), interpolation_(), selSchema_(), value_(val), name2_(), value2_( ) // set value manually if needed
267290 { statement_type (DIRECTIVE); }
291+
292+ Directive::Directive (ParserState pstate, Interpolation2Obj itpl, SelectorListObj sel, Block_Obj b, Expression_Obj val)
293+ : Has_Block(pstate, b), keyword_(), selector_(sel), interpolation_(itpl), selSchema_(), value_(val), name2_(), value2_() // set value manually if needed
294+ {
295+ statement_type (DIRECTIVE);
296+ }
297+
268298 Directive::Directive (const Directive* ptr)
269299 : Has_Block(ptr),
270300 keyword_(ptr->keyword_),
271301 selector_(ptr->selector_),
302+ interpolation_(ptr->interpolation_),
272303 selSchema_(ptr->selSchema_),
273- value_(ptr->value_) // set value manually if needed
304+ value_(ptr->value_),
305+ name2_(ptr->name2_),
306+ value2_(ptr->value2_) // set value manually if needed
274307 { statement_type (DIRECTIVE); }
275308
276309 bool Directive::bubbles () { return is_keyframes () || is_media (); }
@@ -292,10 +325,10 @@ namespace Sass {
292325 // ///////////////////////////////////////////////////////////////////////
293326
294327 Keyframe_Rule::Keyframe_Rule (ParserState pstate, Block_Obj b)
295- : Has_Block(pstate, b), name_()
328+ : Has_Block(pstate, b), name_(), name2_()
296329 { statement_type (KEYFRAMERULE); }
297330 Keyframe_Rule::Keyframe_Rule (const Keyframe_Rule* ptr)
298- : Has_Block(ptr), name_(ptr->name_)
331+ : Has_Block(ptr), name_(ptr->name_), name2_(ptr->name2_)
299332 { statement_type (KEYFRAMERULE); }
300333
301334 // ///////////////////////////////////////////////////////////////////////
@@ -304,6 +337,7 @@ namespace Sass {
304337 Declaration::Declaration (ParserState pstate, String_Obj prop, Expression_Obj val, bool i, bool c, Block_Obj b)
305338 : Has_Block(pstate, b), property_(prop), value_(val), is_important_(i), is_custom_property_(c), is_indented_(false )
306339 { statement_type (DECLARATION); }
340+
307341 Declaration::Declaration (const Declaration* ptr)
308342 : Has_Block(ptr),
309343 property_(ptr->property_),
@@ -319,6 +353,23 @@ namespace Sass {
319353 return !(value_ && !Cast<Null>(value_));
320354 }
321355
356+
357+ Declaration2::Declaration2 (const Declaration2* ptr) :
358+ Has_Block(ptr),
359+ name_(ptr->name_),
360+ value_(ptr->value_)
361+ {
362+ statement_type (DECLARATION);
363+ }
364+
365+ CssDeclaration::CssDeclaration (const CssDeclaration* ptr) :
366+ Statement(ptr),
367+ name_(ptr->name_),
368+ value_(ptr->value_)
369+ {
370+ statement_type (DECLARATION);
371+ }
372+
322373 // ///////////////////////////////////////////////////////////////////////
323374 // ///////////////////////////////////////////////////////////////////////
324375
@@ -351,9 +402,9 @@ namespace Sass {
351402
352403 StaticImport::StaticImport (
353404 ParserState pstate,
354- String_Schema_Obj url,
405+ Interpolation2Obj url,
355406 Supports_Condition_Obj supports,
356- String_Schema_Obj media) :
407+ Interpolation2Obj media) :
357408 ImportBase(pstate),
358409 url_(url),
359410 supports_(supports),
@@ -404,19 +455,29 @@ namespace Sass {
404455
405456 Import::Import (ParserState pstate)
406457 : ImportBase(pstate),
407- urls_(std::vector<Expression_Obj>()),
408- incs_(std::vector<Include>()),
409- import_queries_()
458+ urls_(),
459+ incs_(),
460+ imports_(),
461+ import_queries_(),
462+ queries_()
410463 { statement_type (IMPORT); }
411464 Import::Import (const Import* ptr)
412465 : ImportBase(ptr),
413466 urls_(ptr->urls_),
414467 incs_(ptr->incs_),
415- import_queries_(ptr->import_queries_)
468+ imports_(ptr->imports_),
469+ import_queries_(ptr->import_queries_),
470+ queries_(ptr->queries_)
416471 { statement_type (IMPORT); }
417472
418473 std::vector<Include>& Import::incs () { return incs_; }
419474 std::vector<Expression_Obj>& Import::urls () { return urls_; }
475+ std::vector<ImportBaseObj>& Import::imports () { return imports_; }
476+
477+ bool Import::is_invisible () const
478+ {
479+ return incs_.empty () && urls_.empty () && imports_.empty ();
480+ }
420481
421482 // ///////////////////////////////////////////////////////////////////////
422483 // ///////////////////////////////////////////////////////////////////////
@@ -499,7 +560,7 @@ namespace Sass {
499560 // ///////////////////////////////////////////////////////////////////////
500561
501562 For::For (ParserState pstate,
502- std::string var, Expression_Obj lo, Expression_Obj hi, Block_Obj b, bool inc )
563+ std::string var, Expression_Obj lo, Expression_Obj hi, bool inc, Block_Obj b )
503564 : Has_Block(pstate, b),
504565 variable_(var), lower_bound_(lo), upper_bound_(hi), is_inclusive_(inc)
505566 { statement_type (FOR); }
@@ -544,30 +605,16 @@ namespace Sass {
544605 // ///////////////////////////////////////////////////////////////////////
545606 // ///////////////////////////////////////////////////////////////////////
546607
547- ExtendRule::ExtendRule (ParserState pstate, SelectorListObj s, bool optional) :
548- Statement(pstate), isOptional_(optional), selector_(s), schema_()
549- {
550- statement_type (EXTEND);
551- }
552-
553- ExtendRule::ExtendRule (ParserState pstate, Selector_Schema_Obj s, bool optional) :
554- Statement(pstate), isOptional_(optional), selector_(), schema_(s)
608+ ExtendRule::ExtendRule (ParserState pstate, Interpolation2Obj s, bool optional) :
609+ Statement(pstate), isOptional_(optional), selector_(s)
555610 {
556611 statement_type (EXTEND);
557612 }
558613
559- ExtendRule::ExtendRule (ParserState pstate, String_Schema_Obj s, bool optional) :
560- Statement(pstate), isOptional_(optional), selector_(), schema_()
561- {
562- schema (SASS_MEMORY_NEW (Selector_Schema, s->pstate (), s));
563- statement_type (EXTEND);
564- }
565-
566614 ExtendRule::ExtendRule (const ExtendRule* ptr)
567615 : Statement(ptr),
568616 isOptional_(ptr->isOptional_),
569- selector_(ptr->selector_),
570- schema_(ptr->schema_)
617+ selector_(ptr->selector_)
571618 { statement_type (EXTEND); }
572619
573620 // ///////////////////////////////////////////////////////////////////////
@@ -931,7 +978,9 @@ namespace Sass {
931978 bool At_Root_Query::exclude (std::string str)
932979 {
933980 bool with = feature () && unquote (feature ()->to_string ()).compare (" with" ) == 0 ;
934- List* l = static_cast <List*>(value ().ptr ());
981+ // bool with = feature() && Util::equalsLiteral("(with", unquote(feature()->to_string())) /*&&
982+ // !Util::equalsLiteral("(without", unquote(feature()->to_string()))*/;
983+ List* l = Cast<List>(value ().ptr ());
935984 std::string v;
936985
937986 if (with)
@@ -1102,6 +1151,8 @@ namespace Sass {
11021151 IMPLEMENT_AST_OPERATORS (Bubble);
11031152 IMPLEMENT_AST_OPERATORS (Definition);
11041153 IMPLEMENT_AST_OPERATORS (Declaration);
1154+ IMPLEMENT_AST_OPERATORS (Declaration2);
1155+ IMPLEMENT_AST_OPERATORS (CssDeclaration);
11051156
11061157 // ///////////////////////////////////////////////////////////////////////
11071158 // ///////////////////////////////////////////////////////////////////////
0 commit comments