@@ -23,6 +23,7 @@ namespace Sass {
23
23
case MUL: return 6 ;
24
24
case DIV: return 6 ;
25
25
case MOD: return 6 ;
26
+ case IESEQ: return 9 ;
26
27
// this is only used internally!
27
28
case NUM_OPS: return 99 ;
28
29
default : return 255 ;
@@ -44,7 +45,8 @@ namespace Sass {
44
45
case MUL: return " times" ;
45
46
case DIV: return " div" ;
46
47
case MOD: return " mod" ;
47
- // this is only used internally!
48
+ case IESEQ: return " seq" ;
49
+ // this is only used internally!
48
50
case NUM_OPS: return " [OPS]" ;
49
51
default : return " invalid" ;
50
52
}
@@ -65,6 +67,7 @@ namespace Sass {
65
67
if (op == " *" ) return MUL;
66
68
if (op == " /" ) return DIV;
67
69
if (op == " &" ) return MOD;
70
+ if (op == " =" ) return IESEQ;
68
71
return NUM_OPS;
69
72
}
70
73
@@ -83,7 +86,8 @@ namespace Sass {
83
86
case MUL: return " *" ;
84
87
case DIV: return " /" ;
85
88
case MOD: return " %" ;
86
- // this is only used internally!
89
+ case IESEQ: return " =" ;
90
+ // this is only used internally!
87
91
case NUM_OPS: return " [OPS]" ;
88
92
default : return " invalid" ;
89
93
}
@@ -114,6 +118,7 @@ namespace Sass {
114
118
Sass_Output_Options out (opt);
115
119
Emitter emitter (out);
116
120
Inspect i (emitter);
121
+ i.quotes = false ;
117
122
i.in_declaration = true ;
118
123
// ToDo: inspect should be const
119
124
const_cast <AST_Node*>(this )->perform (&i);
@@ -125,6 +130,11 @@ namespace Sass {
125
130
return to_string ({ NESTED, 5 });
126
131
}
127
132
133
+ std::string AST_Node::to_css () const
134
+ {
135
+ return to_css ({ NESTED, 5 });
136
+ }
137
+
128
138
// ///////////////////////////////////////////////////////////////////////
129
139
// ///////////////////////////////////////////////////////////////////////
130
140
@@ -211,7 +221,7 @@ namespace Sass {
211
221
: Has_Block(pstate, b), selector_(s), schema_(), is_root_(false )
212
222
{ statement_type (RULESET); }
213
223
214
- Ruleset::Ruleset (ParserState pstate, Selector_Schema * s, Block_Obj b)
224
+ Ruleset::Ruleset (ParserState pstate, Interpolation2 * s, Block_Obj b)
215
225
: Has_Block(pstate, b), selector_(), schema_(s), is_root_(false )
216
226
{ statement_type (RULESET); }
217
227
@@ -223,11 +233,24 @@ namespace Sass {
223
233
{ statement_type (RULESET); }
224
234
225
235
bool Ruleset::is_invisible () const {
236
+ bool sel_invisible = true ;
237
+ bool els_invisible = true ;
226
238
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
+ }
229
245
}
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;
231
254
}
232
255
233
256
// ///////////////////////////////////////////////////////////////////////
@@ -263,14 +286,24 @@ namespace Sass {
263
286
// ///////////////////////////////////////////////////////////////////////
264
287
265
288
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
267
290
{ 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
+
268
298
Directive::Directive (const Directive* ptr)
269
299
: Has_Block(ptr),
270
300
keyword_(ptr->keyword_),
271
301
selector_(ptr->selector_),
302
+ interpolation_(ptr->interpolation_),
272
303
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
274
307
{ statement_type (DIRECTIVE); }
275
308
276
309
bool Directive::bubbles () { return is_keyframes () || is_media (); }
@@ -292,10 +325,10 @@ namespace Sass {
292
325
// ///////////////////////////////////////////////////////////////////////
293
326
294
327
Keyframe_Rule::Keyframe_Rule (ParserState pstate, Block_Obj b)
295
- : Has_Block(pstate, b), name_()
328
+ : Has_Block(pstate, b), name_(), name2_()
296
329
{ statement_type (KEYFRAMERULE); }
297
330
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_)
299
332
{ statement_type (KEYFRAMERULE); }
300
333
301
334
// ///////////////////////////////////////////////////////////////////////
@@ -304,6 +337,7 @@ namespace Sass {
304
337
Declaration::Declaration (ParserState pstate, String_Obj prop, Expression_Obj val, bool i, bool c, Block_Obj b)
305
338
: Has_Block(pstate, b), property_(prop), value_(val), is_important_(i), is_custom_property_(c), is_indented_(false )
306
339
{ statement_type (DECLARATION); }
340
+
307
341
Declaration::Declaration (const Declaration* ptr)
308
342
: Has_Block(ptr),
309
343
property_(ptr->property_),
@@ -319,6 +353,23 @@ namespace Sass {
319
353
return !(value_ && !Cast<Null>(value_));
320
354
}
321
355
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
+
322
373
// ///////////////////////////////////////////////////////////////////////
323
374
// ///////////////////////////////////////////////////////////////////////
324
375
@@ -351,9 +402,9 @@ namespace Sass {
351
402
352
403
StaticImport::StaticImport (
353
404
ParserState pstate,
354
- String_Schema_Obj url,
405
+ Interpolation2Obj url,
355
406
Supports_Condition_Obj supports,
356
- String_Schema_Obj media) :
407
+ Interpolation2Obj media) :
357
408
ImportBase(pstate),
358
409
url_(url),
359
410
supports_(supports),
@@ -404,19 +455,29 @@ namespace Sass {
404
455
405
456
Import::Import (ParserState pstate)
406
457
: 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_()
410
463
{ statement_type (IMPORT); }
411
464
Import::Import (const Import* ptr)
412
465
: ImportBase(ptr),
413
466
urls_(ptr->urls_),
414
467
incs_(ptr->incs_),
415
- import_queries_(ptr->import_queries_)
468
+ imports_(ptr->imports_),
469
+ import_queries_(ptr->import_queries_),
470
+ queries_(ptr->queries_)
416
471
{ statement_type (IMPORT); }
417
472
418
473
std::vector<Include>& Import::incs () { return incs_; }
419
474
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
+ }
420
481
421
482
// ///////////////////////////////////////////////////////////////////////
422
483
// ///////////////////////////////////////////////////////////////////////
@@ -499,7 +560,7 @@ namespace Sass {
499
560
// ///////////////////////////////////////////////////////////////////////
500
561
501
562
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 )
503
564
: Has_Block(pstate, b),
504
565
variable_(var), lower_bound_(lo), upper_bound_(hi), is_inclusive_(inc)
505
566
{ statement_type (FOR); }
@@ -544,30 +605,16 @@ namespace Sass {
544
605
// ///////////////////////////////////////////////////////////////////////
545
606
// ///////////////////////////////////////////////////////////////////////
546
607
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)
555
610
{
556
611
statement_type (EXTEND);
557
612
}
558
613
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
-
566
614
ExtendRule::ExtendRule (const ExtendRule* ptr)
567
615
: Statement(ptr),
568
616
isOptional_(ptr->isOptional_),
569
- selector_(ptr->selector_),
570
- schema_(ptr->schema_)
617
+ selector_(ptr->selector_)
571
618
{ statement_type (EXTEND); }
572
619
573
620
// ///////////////////////////////////////////////////////////////////////
@@ -931,7 +978,9 @@ namespace Sass {
931
978
bool At_Root_Query::exclude (std::string str)
932
979
{
933
980
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 ());
935
984
std::string v;
936
985
937
986
if (with)
@@ -1102,6 +1151,8 @@ namespace Sass {
1102
1151
IMPLEMENT_AST_OPERATORS (Bubble);
1103
1152
IMPLEMENT_AST_OPERATORS (Definition);
1104
1153
IMPLEMENT_AST_OPERATORS (Declaration);
1154
+ IMPLEMENT_AST_OPERATORS (Declaration2);
1155
+ IMPLEMENT_AST_OPERATORS (CssDeclaration);
1105
1156
1106
1157
// ///////////////////////////////////////////////////////////////////////
1107
1158
// ///////////////////////////////////////////////////////////////////////
0 commit comments