@@ -287,11 +287,11 @@ namespace Sass {
287
287
}
288
288
if (!found)
289
289
{
290
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( *rhs);
290
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, *rhs);
291
291
(*cpy) << this ;
292
292
return cpy;
293
293
}
294
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( rhs->pstate ());
294
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, rhs->pstate ());
295
295
for (size_t j = 0 ; j < i; ++j)
296
296
{ (*cpy) << (*rhs)[j]; }
297
297
(*cpy) << this ;
@@ -311,7 +311,7 @@ namespace Sass {
311
311
if (!rhs->is_universal_ns ())
312
312
{
313
313
// creaty the copy inside (avoid unnecessary copies)
314
- Type_Selector* ts = new (ctx.mem ) Type_Selector ( *this );
314
+ Type_Selector* ts = SASS_MEMORY_NEW (ctx.mem , Type_Selector, *this );
315
315
// overwrite the name if star is given as name
316
316
if (ts->name () == " *" ) { ts->name (rhs->name ()); }
317
317
// now overwrite the namespace name and flag
@@ -325,7 +325,7 @@ namespace Sass {
325
325
if (name () == " *" && rhs->name () != " *" )
326
326
{
327
327
// creaty the copy inside (avoid unnecessary copies)
328
- Type_Selector* ts = new (ctx.mem ) Type_Selector ( *this );
328
+ Type_Selector* ts = SASS_MEMORY_NEW (ctx.mem , Type_Selector, *this );
329
329
// simply set the new name
330
330
ts->name (rhs->name ());
331
331
// return copy
@@ -341,7 +341,7 @@ namespace Sass {
341
341
342
342
// if the rhs is empty, just return a copy of this
343
343
if (rhs->length () == 0 ) {
344
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( rhs->pstate ());
344
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, rhs->pstate ());
345
345
(*cpy) << this ;
346
346
return cpy;
347
347
}
@@ -353,14 +353,14 @@ namespace Sass {
353
353
if (typeid (*rhs_0) == typeid (Type_Selector))
354
354
{
355
355
// if rhs is universal, just return this tagname + rhs's qualifiers
356
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( *rhs);
356
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, *rhs);
357
357
Type_Selector* ts = static_cast <Type_Selector*>(rhs_0);
358
358
(*cpy)[0 ] = this ->unify_with (ts, ctx);
359
359
return cpy;
360
360
}
361
361
else if (dynamic_cast <Selector_Qualifier*>(rhs_0)) {
362
362
// qualifier is `.class`, so we can prefix with `ns|*.class`
363
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( rhs->pstate ());
363
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, rhs->pstate ());
364
364
if (has_ns () && !rhs_0->has_ns ()) {
365
365
if (ns () != " *" ) (*cpy) << this ;
366
366
}
@@ -378,13 +378,13 @@ namespace Sass {
378
378
// if rhs is universal, just return this tagname + rhs's qualifiers
379
379
if (rhs_0->name () != " *" && rhs_0->ns () != " *" && rhs_0->name () != name ()) return 0 ;
380
380
// otherwise create new compound and unify first simple selector
381
- Compound_Selector* copy = new (ctx.mem ) Compound_Selector ( *rhs);
381
+ Compound_Selector* copy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, *rhs);
382
382
(*copy)[0 ] = this ->unify_with (rhs_0, ctx);
383
383
return copy;
384
384
385
385
}
386
386
// else it's a tag name and a bunch of qualifiers -- just append them
387
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( rhs->pstate ());
387
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, rhs->pstate ());
388
388
if (name () != " *" ) (*cpy) << this ;
389
389
(*cpy) += rhs;
390
390
return cpy;
@@ -588,10 +588,11 @@ namespace Sass {
588
588
Complex_Selector* Compound_Selector::to_complex (Memory_Manager<AST_Node>& mem)
589
589
{
590
590
// create an intermediate complex selector
591
- return new (mem) Complex_Selector (pstate (),
592
- Complex_Selector::ANCESTOR_OF,
593
- this ,
594
- 0 );
591
+ return SASS_MEMORY_NEW (mem, Complex_Selector,
592
+ pstate (),
593
+ Complex_Selector::ANCESTOR_OF,
594
+ this ,
595
+ 0 );
595
596
}
596
597
597
598
Selector_List* Complex_Selector::unify_with (Complex_Selector* other, Context& ctx)
@@ -652,7 +653,7 @@ namespace Sass {
652
653
653
654
// do some magic we inherit from node and extend
654
655
Node node = Extend::subweave (lhsNode, rhsNode, ctx);
655
- Selector_List* result = new (ctx.mem ) Selector_List ( pstate ());
656
+ Selector_List* result = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
656
657
NodeDequePtr col = node.collection (); // move from collection to list
657
658
for (NodeDeque::iterator it = col->begin (), end = col->end (); it != end; it++)
658
659
{ (*result) << nodeToComplexSelector (Node::naiveTrim (*it, ctx), ctx); }
@@ -796,7 +797,7 @@ namespace Sass {
796
797
{
797
798
if (!tail ()) return 0 ;
798
799
if (!head ()) return tail ()->context (ctx);
799
- Complex_Selector* cpy = new (ctx.mem ) Complex_Selector ( pstate (), combinator (), head (), tail ()->context (ctx));
800
+ Complex_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Complex_Selector, pstate (), combinator (), head (), tail ()->context (ctx));
800
801
cpy->media_block (media_block ());
801
802
return cpy;
802
803
}
@@ -829,7 +830,7 @@ namespace Sass {
829
830
830
831
if (last ()) {
831
832
if (last ()->combinator () != ANCESTOR_OF && c != ANCESTOR_OF) {
832
- Complex_Selector* inter = new (ctx.mem ) Complex_Selector ( pstate ());
833
+ Complex_Selector* inter = SASS_MEMORY_NEW (ctx.mem , Complex_Selector, pstate ());
833
834
inter->reference (r);
834
835
inter->combinator (c);
835
836
inter->tail (t);
@@ -848,9 +849,9 @@ namespace Sass {
848
849
849
850
Selector_List* Selector_List::parentize (Selector_List* ps, Context& ctx)
850
851
{
851
- Selector_List* ss = new (ctx.mem ) Selector_List ( pstate ());
852
+ Selector_List* ss = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
852
853
for (size_t pi = 0 , pL = ps->length (); pi < pL; ++pi) {
853
- Selector_List* list = new (ctx.mem ) Selector_List ( pstate ());
854
+ Selector_List* list = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
854
855
*list << (*ps)[pi];
855
856
for (size_t si = 0 , sL = this ->length (); si < sL ; ++si) {
856
857
*ss += (*this )[si]->parentize (list, ctx);
@@ -874,7 +875,7 @@ namespace Sass {
874
875
// mix parent complex selector into the compound list
875
876
if (dynamic_cast <Parent_Selector*>((*head)[0 ])) {
876
877
if (parents && parents->length ()) {
877
- Selector_List* retval = new (ctx.mem ) Selector_List ( pstate ());
878
+ Selector_List* retval = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
878
879
if (tails && tails->length () > 0 ) {
879
880
for (size_t n = 0 , nL = tails->length (); n < nL; ++n) {
880
881
for (size_t i = 0 , iL = parents->length (); i < iL; ++i) {
@@ -912,12 +913,12 @@ namespace Sass {
912
913
}
913
914
// have no parent but some tails
914
915
else {
915
- Selector_List* retval = new (ctx.mem ) Selector_List ( pstate ());
916
+ Selector_List* retval = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
916
917
if (tails && tails->length () > 0 ) {
917
918
for (size_t n = 0 , nL = tails->length (); n < nL; ++n) {
918
919
Complex_Selector* cpy = this ->clone (ctx);
919
920
cpy->tail ((*tails)[n]->cloneFully (ctx));
920
- cpy->head (new (ctx.mem ) Compound_Selector ( head->pstate ()));
921
+ cpy->head (SASS_MEMORY_NEW (ctx.mem , Compound_Selector, head->pstate ()));
921
922
for (size_t i = 1 , L = this ->head ()->length (); i < L; ++i)
922
923
*cpy->head () << (*this ->head ())[i];
923
924
if (!cpy->head ()->length ()) cpy->head (0 );
@@ -927,7 +928,7 @@ namespace Sass {
927
928
// have no parent and not tails
928
929
else {
929
930
Complex_Selector* cpy = this ->clone (ctx);
930
- cpy->head (new (ctx.mem ) Compound_Selector ( head->pstate ()));
931
+ cpy->head (SASS_MEMORY_NEW (ctx.mem , Compound_Selector, head->pstate ()));
931
932
for (size_t i = 1 , L = this ->head ()->length (); i < L; ++i)
932
933
*cpy->head () << (*this ->head ())[i];
933
934
if (!cpy->head ()->length ()) cpy->head (0 );
@@ -953,7 +954,7 @@ namespace Sass {
953
954
954
955
Selector_List* Complex_Selector::tails (Context& ctx, Selector_List* tails)
955
956
{
956
- Selector_List* rv = new (ctx.mem ) Selector_List ( pstate_);
957
+ Selector_List* rv = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate_);
957
958
if (tails && tails->length ()) {
958
959
for (size_t i = 0 , iL = tails->length (); i < iL; ++i) {
959
960
Complex_Selector* pr = this ->clone (ctx);
@@ -1050,14 +1051,14 @@ namespace Sass {
1050
1051
1051
1052
Complex_Selector* Complex_Selector::clone (Context& ctx) const
1052
1053
{
1053
- Complex_Selector* cpy = new (ctx.mem ) Complex_Selector ( *this );
1054
+ Complex_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Complex_Selector, *this );
1054
1055
if (tail ()) cpy->tail (tail ()->clone (ctx));
1055
1056
return cpy;
1056
1057
}
1057
1058
1058
1059
Complex_Selector* Complex_Selector::cloneFully (Context& ctx) const
1059
1060
{
1060
- Complex_Selector* cpy = new (ctx.mem ) Complex_Selector ( *this );
1061
+ Complex_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Complex_Selector, *this );
1061
1062
1062
1063
if (head ()) {
1063
1064
cpy->head (head ()->clone (ctx));
@@ -1072,19 +1073,19 @@ namespace Sass {
1072
1073
1073
1074
Compound_Selector* Compound_Selector::clone (Context& ctx) const
1074
1075
{
1075
- Compound_Selector* cpy = new (ctx.mem ) Compound_Selector ( *this );
1076
+ Compound_Selector* cpy = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, *this );
1076
1077
return cpy;
1077
1078
}
1078
1079
1079
1080
Selector_List* Selector_List::clone (Context& ctx) const
1080
1081
{
1081
- Selector_List* cpy = new (ctx.mem ) Selector_List ( *this );
1082
+ Selector_List* cpy = SASS_MEMORY_NEW (ctx.mem , Selector_List, *this );
1082
1083
return cpy;
1083
1084
}
1084
1085
1085
1086
Selector_List* Selector_List::cloneFully (Context& ctx) const
1086
1087
{
1087
- Selector_List* cpy = new (ctx.mem ) Selector_List ( pstate ());
1088
+ Selector_List* cpy = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
1088
1089
for (size_t i = 0 , L = length (); i < L; ++i) {
1089
1090
*cpy << (*this )[i]->cloneFully (ctx);
1090
1091
}
@@ -1182,7 +1183,7 @@ namespace Sass {
1182
1183
}
1183
1184
1184
1185
// Creates the final Selector_List by combining all the complex selectors
1185
- Selector_List* final_result = new (ctx.mem ) Selector_List ( pstate ());
1186
+ Selector_List* final_result = SASS_MEMORY_NEW (ctx.mem , Selector_List, pstate ());
1186
1187
for (auto itr = unified_complex_selectors.begin (); itr != unified_complex_selectors.end (); ++itr) {
1187
1188
*final_result << *itr;
1188
1189
}
@@ -1235,7 +1236,7 @@ namespace Sass {
1235
1236
Compound_Selector* Compound_Selector::minus (Compound_Selector* rhs, Context& ctx)
1236
1237
{
1237
1238
To_String to_string (&ctx);
1238
- Compound_Selector* result = new (ctx.mem ) Compound_Selector ( pstate ());
1239
+ Compound_Selector* result = SASS_MEMORY_NEW (ctx.mem , Compound_Selector, pstate ());
1239
1240
// result->has_parent_reference(has_parent_reference());
1240
1241
1241
1242
// not very efficient because it needs to preserve order
0 commit comments