10
10
11
11
namespace Sass {
12
12
13
- // static Null sass_null(SourceSpan::fake ("null"));
13
+ // static Null sass_null(SourceSpan("null"));
14
14
15
15
uint8_t sass_op_to_precedence (enum Sass_OP op) {
16
16
switch (op) {
@@ -137,15 +137,14 @@ namespace Sass {
137
137
// ///////////////////////////////////////////////////////////////////////
138
138
139
139
Statement::Statement (const SourceSpan& pstate, size_t t)
140
- : AST_Node(pstate), tabs_(t), group_end_( false )
140
+ : AST_Node(pstate), tabs_(t)
141
141
{ }
142
142
Statement::Statement (SourceSpan&& pstate, size_t t)
143
- : AST_Node(std::move(pstate)), tabs_(t), group_end_( false )
143
+ : AST_Node(std::move(pstate)), tabs_(t)
144
144
{ }
145
145
Statement::Statement (const Statement* ptr)
146
146
: AST_Node(ptr),
147
- tabs_ (ptr->tabs_),
148
- group_end_(ptr->group_end_)
147
+ tabs_ (ptr->tabs_)
149
148
{ }
150
149
151
150
bool Statement::bubbles () const
@@ -168,19 +167,19 @@ namespace Sass {
168
167
169
168
Block::Block (const SourceSpan& pstate, size_t s, bool r)
170
169
: Statement(pstate),
171
- Vectorized <Statement>(s),
170
+ VectorizedBase <Statement>(s),
172
171
idxs_(0 ), is_root_(r)
173
172
{ }
174
173
175
174
Block::Block (const SourceSpan& pstate, const sass::vector<StatementObj>& vec, bool r) :
176
175
Statement(pstate),
177
- Vectorized <Statement>(vec),
176
+ VectorizedBase <Statement>(vec),
178
177
idxs_(0 ), is_root_(r)
179
178
{ }
180
179
181
180
Block::Block (const SourceSpan& pstate, sass::vector<StatementObj>&& vec, bool r) :
182
181
Statement(pstate),
183
- Vectorized <Statement>(std::move(vec)),
182
+ VectorizedBase <Statement>(std::move(vec)),
184
183
idxs_(0 ), is_root_(r)
185
184
{ }
186
185
@@ -250,7 +249,7 @@ namespace Sass {
250
249
// ///////////////////////////////////////////////////////////////////////
251
250
252
251
Bubble::Bubble (const SourceSpan& pstate, Statement_Obj n, Statement_Obj g, size_t t)
253
- : Statement(pstate, t), node_(n), group_end_(g == nullptr )
252
+ : Statement(pstate, t), node_(n)
254
253
{ }
255
254
256
255
bool Bubble::bubbles () const
@@ -363,7 +362,7 @@ namespace Sass {
363
362
ImportRule::ImportRule (
364
363
const SourceSpan& pstate) :
365
364
Statement(pstate),
366
- Vectorized ()
365
+ VectorizedBase ()
367
366
{}
368
367
369
368
// ///////////////////////////////////////////////////////////////////////
@@ -499,24 +498,43 @@ namespace Sass {
499
498
// ///////////////////////////////////////////////////////////////////////
500
499
// ///////////////////////////////////////////////////////////////////////
501
500
502
- Expression::Expression (const SourceSpan& pstate, bool d, bool e, bool i, Type ct)
503
- : SassNode(pstate),
504
- concrete_type_(ct)
501
+ Interpolant::Interpolant (const SourceSpan& pstate)
502
+ : AST_Node(pstate)
505
503
{ }
506
504
507
- Expression::Expression (SourceSpan&& pstate, bool d, bool e, bool i, Type ct)
508
- : SassNode(std::move(pstate)),
509
- concrete_type_(ct)
505
+ bool Interpolant::operator ==(const Interpolant & rhs) const
506
+ {
507
+ if (const Expression* ex = Cast<Expression>(&rhs)) {
508
+ return *this == *ex;
509
+ }
510
+ else if (const ItplString* str = Cast<ItplString>(&rhs)) {
511
+ return *this == *str;
512
+ }
513
+ return false ;
514
+ }
515
+
516
+ Interpolant::Interpolant (SourceSpan&& pstate)
517
+ : AST_Node(std::move(pstate))
510
518
{ }
511
519
512
- Expression::Expression (const Expression* ptr)
513
- : SassNode(ptr),
514
- concrete_type_(ptr->concrete_type_)
520
+ Interpolant::Interpolant (const Interpolant* ptr)
521
+ : AST_Node(ptr)
515
522
{ }
516
523
517
- SassNode::SassNode (const SassNode* ptr) :
518
- AST_Node(ptr)
519
- {};
524
+ // ///////////////////////////////////////////////////////////////////////
525
+ // ///////////////////////////////////////////////////////////////////////
526
+
527
+ Expression::Expression (const SourceSpan& pstate, bool d, bool e, bool i)
528
+ : Interpolant(pstate)
529
+ { }
530
+
531
+ Expression::Expression (SourceSpan&& pstate, bool d, bool e, bool i)
532
+ : Interpolant(std::move(pstate))
533
+ { }
534
+
535
+ Expression::Expression (const Expression* ptr)
536
+ : Interpolant(ptr)
537
+ { }
520
538
521
539
// ///////////////////////////////////////////////////////////////////////
522
540
// ///////////////////////////////////////////////////////////////////////
@@ -552,14 +570,6 @@ namespace Sass {
552
570
{
553
571
}
554
572
555
- size_t Argument::hash () const
556
- {
557
- if (hash_ == 0 ) {
558
- hash_start (hash_, name ().hash ());
559
- hash_combine (hash_, value ()->hash ());
560
- }
561
- return hash_;
562
- }
563
573
564
574
// ///////////////////////////////////////////////////////////////////////
565
575
// ///////////////////////////////////////////////////////////////////////
@@ -604,15 +614,9 @@ namespace Sass {
604
614
}
605
615
606
616
// Returns whether [this] excludes [node].
607
- bool AtRootQuery::excludes (Statement * node) const
617
+ bool AtRootQuery::excludes (CssParentNode * node) const
608
618
{
609
619
if (all ()) return !include ();
610
- if (!Cast<CssMediaRule>(node)) {
611
- if (!Cast<CssParentNode>(node)) {
612
- std::cerr << " has non CssParentNode\n " ;
613
- debug_ast (node);
614
- }
615
- }
616
620
if (rule () && Cast<CssStyleRule>(node)) return !include ();
617
621
return excludesName (_nameFor (node));
618
622
}
@@ -726,7 +730,7 @@ namespace Sass {
726
730
const EnvKeyFlatMap<ExpressionObj>& named,
727
731
Expression* restArg,
728
732
Expression* kwdRest) :
729
- SassNode (pstate),
733
+ AST_Node (pstate),
730
734
positional_(positional),
731
735
named_(named),
732
736
restArg_(restArg),
@@ -775,7 +779,7 @@ namespace Sass {
775
779
// ///////////////////////////////////////////////////////////////////////
776
780
// ///////////////////////////////////////////////////////////////////////
777
781
778
- ArgumentResults2::ArgumentResults2 (
782
+ ArgumentResults::ArgumentResults (
779
783
const sass::vector<ValueObj>& positional,
780
784
const EnvKeyFlatMap<ValueObj>& named,
781
785
Sass_Separator separator) :
@@ -785,8 +789,8 @@ namespace Sass {
785
789
{
786
790
}
787
791
788
- ArgumentResults2::ArgumentResults2 (
789
- sass::vector<ValueObj> && positional,
792
+ ArgumentResults::ArgumentResults (
793
+ sass::vector<ValueObj>&& positional,
790
794
EnvKeyFlatMap<ValueObj>&& named,
791
795
Sass_Separator separator) :
792
796
positional_(std::move(positional)),
@@ -795,23 +799,23 @@ namespace Sass {
795
799
{
796
800
}
797
801
798
- ArgumentResults2::ArgumentResults2 (
799
- const ArgumentResults2 & other) :
802
+ ArgumentResults::ArgumentResults (
803
+ const ArgumentResults & other) :
800
804
positional_(other.positional_),
801
805
named_(other.named_),
802
806
separator_(other.separator_)
803
807
{
804
808
}
805
809
806
- ArgumentResults2::ArgumentResults2 (
807
- ArgumentResults2 && other) noexcept :
810
+ ArgumentResults::ArgumentResults (
811
+ ArgumentResults && other) noexcept :
808
812
positional_(std::move(other.positional_)),
809
813
named_(std::move(other.named_)),
810
814
separator_(other.separator_)
811
815
{
812
816
}
813
817
814
- ArgumentResults2& ArgumentResults2 ::operator =(ArgumentResults2 && other) noexcept {
818
+ ArgumentResults& ArgumentResults ::operator =(ArgumentResults && other) noexcept {
815
819
positional_ = std::move (other.positional_ );
816
820
named_ = std::move (other.named_ );
817
821
separator_ = other.separator_ ;
@@ -822,7 +826,7 @@ namespace Sass {
822
826
const SourceSpan& pstate,
823
827
const sass::vector<ArgumentObj>& arguments,
824
828
const sass::string& restArg) :
825
- SassNode (pstate),
829
+ AST_Node (pstate),
826
830
arguments_ (arguments),
827
831
restArg_ (restArg)
828
832
{
@@ -860,8 +864,8 @@ namespace Sass {
860
864
while (i < std::min (positional, iL)) {
861
865
if (names.count (arguments_[i]->name ()) == 1 ) {
862
866
throw Exception::InvalidSyntax (arguments_[i]->pstate (), traces,
863
- " Argument " + arguments_[i]->name ().orig () + " name was passed both by position and by "
864
- " name." );
867
+ " Argument " + arguments_[i]->name ().orig () +
868
+ " name was passed both by position and by name." );
865
869
}
866
870
i++;
867
871
}
@@ -899,7 +903,7 @@ namespace Sass {
899
903
// sass::sstream strm;
900
904
// strm << "No " << pluralize("argument", unknownNames.size());
901
905
// strm << " named " << toSentence(unknownNames, "or");
902
- throw Exception::InvalidSyntax (SourceSpan::fake (" [pstate77]" ), traces,
906
+ throw Exception::InvalidSyntax (SourceSpan (" [pstate77]" ), traces,
903
907
" No argument named " + toSentence (unknownNames, " or" ) + " ." );
904
908
}
905
909
@@ -929,15 +933,6 @@ namespace Sass {
929
933
return true ;
930
934
}
931
935
932
- sass::string ArgumentDeclaration::toString2 () const
933
- {
934
- sass::vector<sass::string> results;
935
- for (Argument* argument : arguments_) { // XXXXXXXXXXXYYYYYYY
936
- results.emplace_back (argument->name ().orig ());
937
- }
938
- return Util::join_strings (results, " , " );
939
- }
940
-
941
936
CallableDeclaration::CallableDeclaration (
942
937
const SourceSpan& pstate,
943
938
const EnvKey& name,
@@ -1051,7 +1046,7 @@ namespace Sass {
1051
1046
const sass::string& name,
1052
1047
ArgumentDeclaration* parameters,
1053
1048
Sass_Function_Entry function) :
1054
- Callable (SourceSpan::fake (" [external]" )),
1049
+ Callable (SourceSpan(" [external]" )),
1055
1050
name_ (name),
1056
1051
declaration_ (parameters),
1057
1052
function_ (function)
0 commit comments