@@ -566,14 +566,52 @@ namespace Sass {
566
566
for (size_t i = 0 , L = b->length (); i < L; ++i) {
567
567
Statement* stm = (*b)[i];
568
568
if (typeid (*stm) == typeid (At_Rule)) return true ;
569
- if (typeid (*stm) == typeid (Declaration)) return true ;
570
- if (Has_Block* child = dynamic_cast <Has_Block*>(stm)) {
571
- if (isPrintable (child->block (), style)) return true ;
569
+ else if (typeid (*stm) == typeid (Declaration)) return true ;
570
+ else if (typeid (*stm) == typeid (Comment)) {
571
+ Comment* c = (Comment*) stm;
572
+ if (isPrintable (c, style)) {
573
+ return true ;
574
+ }
575
+ }
576
+ else if (typeid (*stm) == typeid (Ruleset)) {
577
+ Ruleset* r = (Ruleset*) stm;
578
+ if (isPrintable (r, style)) {
579
+ return true ;
580
+ }
581
+ }
582
+ else if (typeid (*stm) == typeid (Supports_Block)) {
583
+ Supports_Block* f = (Supports_Block*) stm;
584
+ if (isPrintable (f, style)) {
585
+ return true ;
586
+ }
587
+ }
588
+ else if (typeid (*stm) == typeid (Media_Block)) {
589
+ Media_Block* m = (Media_Block*) stm;
590
+ if (isPrintable (m, style)) {
591
+ return true ;
592
+ }
593
+ }
594
+ else if (dynamic_cast <Has_Block*>(stm) && isPrintable (((Has_Block*)stm)->block (), style)) {
595
+ return true ;
572
596
}
573
597
}
574
598
return false ;
575
599
}
576
600
601
+ bool isPrintable (Comment* c, Sass_Output_Style style)
602
+ {
603
+ // keep for uncompressed
604
+ if (style != COMPRESSED) {
605
+ return true ;
606
+ }
607
+ // output style compressed
608
+ if (c->is_important ()) {
609
+ return true ;
610
+ }
611
+ // not printable
612
+ return false ;
613
+ };
614
+
577
615
bool isPrintable (Block* b, Sass_Output_Style style) {
578
616
if (b == NULL ) {
579
617
return false ;
@@ -586,12 +624,7 @@ namespace Sass {
586
624
}
587
625
else if (typeid (*stm) == typeid (Comment)) {
588
626
Comment* c = (Comment*) stm;
589
- // keep for uncompressed
590
- if (style != COMPRESSED) {
591
- return true ;
592
- }
593
- // output style compressed
594
- if (c->is_important ()) {
627
+ if (isPrintable (c, style)) {
595
628
return true ;
596
629
}
597
630
}
0 commit comments