@@ -305,6 +305,7 @@ namespace Sass {
305
305
SUPPORTS,
306
306
ATROOT,
307
307
BUBBLE,
308
+ CONTENT,
308
309
KEYFRAMERULE,
309
310
DECLARATION,
310
311
ASSIGNMENT,
@@ -336,6 +337,10 @@ namespace Sass {
336
337
virtual bool is_invisible () const { return false ; }
337
338
virtual bool bubbles () { return false ; }
338
339
virtual Block* block () { return 0 ; }
340
+ virtual bool has_content ()
341
+ {
342
+ return statement_type_ == CONTENT;
343
+ }
339
344
};
340
345
inline Statement::~Statement () { }
341
346
@@ -358,8 +363,18 @@ namespace Sass {
358
363
Block (ParserState pstate, size_t s = 0 , bool r = false )
359
364
: Statement(pstate),
360
365
Vectorized<Statement*>(s),
361
- is_root_ (r), is_at_root_(false ), has_hoistable_(false ), has_non_hoistable_(false )
366
+ is_root_ (r),
367
+ is_at_root_(false ),
368
+ has_hoistable_(false ),
369
+ has_non_hoistable_(false )
362
370
{ }
371
+ virtual bool has_content ()
372
+ {
373
+ for (size_t i = 0 , L = elements ().size (); i < L; ++i) {
374
+ if (elements ()[i]->has_content ()) return true ;
375
+ }
376
+ return Statement::has_content ();
377
+ }
363
378
Block* block () { return this ; }
364
379
ATTACH_OPERATIONS ()
365
380
};
@@ -373,6 +388,10 @@ namespace Sass {
373
388
Has_Block (ParserState pstate, Block* b)
374
389
: Statement(pstate), block_(b)
375
390
{ }
391
+ virtual bool has_content ()
392
+ {
393
+ return block_->has_content () || Statement::has_content ();
394
+ }
376
395
virtual ~Has_Block () = 0 ;
377
396
};
378
397
inline Has_Block::~Has_Block () { }
@@ -765,7 +784,8 @@ namespace Sass {
765
784
// /////////////////////////////////////////////////
766
785
class Content : public Statement {
767
786
public:
768
- Content (ParserState pstate) : Statement(pstate) { }
787
+ Content (ParserState pstate) : Statement(pstate)
788
+ { statement_type (CONTENT); }
769
789
ATTACH_OPERATIONS ()
770
790
};
771
791
0 commit comments