sassc 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +3 -2
- data/ext/libsass/Makefile.conf +2 -1
- data/ext/libsass/appveyor.yml +10 -5
- data/ext/libsass/docs/dev-ast-memory.md +223 -0
- data/ext/libsass/include/sass/base.h +2 -0
- data/ext/libsass/script/bootstrap +7 -4
- data/ext/libsass/script/ci-build-libsass +3 -3
- data/ext/libsass/script/ci-install-compiler +2 -0
- data/ext/libsass/script/ci-report-coverage +2 -1
- data/ext/libsass/script/test-leaks.pl +103 -0
- data/ext/libsass/src/ast.cpp +621 -495
- data/ext/libsass/src/ast.hpp +801 -367
- data/ext/libsass/src/ast_def_macros.hpp +5 -5
- data/ext/libsass/src/ast_fwd_decl.hpp +312 -14
- data/ext/libsass/src/bind.cpp +54 -51
- data/ext/libsass/src/bind.hpp +3 -7
- data/ext/libsass/src/check_nesting.cpp +117 -120
- data/ext/libsass/src/check_nesting.hpp +38 -34
- data/ext/libsass/src/color_maps.cpp +3 -3
- data/ext/libsass/src/color_maps.hpp +3 -3
- data/ext/libsass/src/context.cpp +33 -34
- data/ext/libsass/src/context.hpp +12 -14
- data/ext/libsass/src/cssize.cpp +200 -228
- data/ext/libsass/src/cssize.hpp +49 -49
- data/ext/libsass/src/debugger.hpp +260 -241
- data/ext/libsass/src/emitter.cpp +6 -6
- data/ext/libsass/src/emitter.hpp +7 -7
- data/ext/libsass/src/environment.cpp +2 -2
- data/ext/libsass/src/environment.hpp +0 -2
- data/ext/libsass/src/error_handling.cpp +5 -5
- data/ext/libsass/src/error_handling.hpp +12 -12
- data/ext/libsass/src/eval.cpp +412 -401
- data/ext/libsass/src/eval.hpp +61 -62
- data/ext/libsass/src/expand.cpp +223 -204
- data/ext/libsass/src/expand.hpp +42 -42
- data/ext/libsass/src/extend.cpp +198 -201
- data/ext/libsass/src/extend.hpp +12 -14
- data/ext/libsass/src/file.hpp +4 -5
- data/ext/libsass/src/functions.cpp +413 -418
- data/ext/libsass/src/functions.hpp +7 -10
- data/ext/libsass/src/inspect.cpp +115 -109
- data/ext/libsass/src/inspect.hpp +69 -69
- data/ext/libsass/src/listize.cpp +31 -33
- data/ext/libsass/src/listize.hpp +8 -10
- data/ext/libsass/src/memory/SharedPtr.cpp +116 -0
- data/ext/libsass/src/memory/SharedPtr.hpp +202 -0
- data/ext/libsass/src/node.cpp +45 -43
- data/ext/libsass/src/node.hpp +15 -15
- data/ext/libsass/src/operation.hpp +136 -136
- data/ext/libsass/src/output.cpp +48 -49
- data/ext/libsass/src/output.hpp +14 -14
- data/ext/libsass/src/parser.cpp +530 -554
- data/ext/libsass/src/parser.hpp +91 -96
- data/ext/libsass/src/prelexer.cpp +13 -10
- data/ext/libsass/src/remove_placeholders.cpp +25 -21
- data/ext/libsass/src/remove_placeholders.hpp +7 -7
- data/ext/libsass/src/sass2scss.cpp +2 -1
- data/ext/libsass/src/sass_context.cpp +125 -107
- data/ext/libsass/src/sass_context.hpp +1 -1
- data/ext/libsass/src/sass_util.hpp +5 -5
- data/ext/libsass/src/sass_values.cpp +27 -27
- data/ext/libsass/src/source_map.cpp +2 -2
- data/ext/libsass/src/source_map.hpp +2 -2
- data/ext/libsass/src/subset_map.cpp +57 -0
- data/ext/libsass/src/subset_map.hpp +8 -76
- data/ext/libsass/src/to_c.cpp +13 -13
- data/ext/libsass/src/to_c.hpp +14 -14
- data/ext/libsass/src/to_value.cpp +20 -20
- data/ext/libsass/src/to_value.hpp +20 -21
- data/ext/libsass/src/util.cpp +55 -88
- data/ext/libsass/src/util.hpp +9 -13
- data/ext/libsass/src/values.cpp +27 -26
- data/ext/libsass/src/values.hpp +2 -2
- data/ext/libsass/test/test_subset_map.cpp +69 -69
- data/ext/libsass/win/libsass.targets +3 -2
- data/ext/libsass/win/libsass.vcxproj.filters +9 -6
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +0 -1
- data/test/native_test.rb +1 -1
- metadata +7 -5
- data/ext/libsass/src/ast_factory.hpp +0 -92
- data/ext/libsass/src/memory_manager.cpp +0 -77
- data/ext/libsass/src/memory_manager.hpp +0 -48
data/ext/libsass/src/expand.hpp
CHANGED
@@ -13,69 +13,69 @@ namespace Sass {
|
|
13
13
|
class Listize;
|
14
14
|
class Context;
|
15
15
|
class Eval;
|
16
|
-
typedef Environment<
|
16
|
+
typedef Environment<AST_Node_Obj> Env;
|
17
17
|
struct Backtrace;
|
18
18
|
|
19
|
-
class Expand : public Operation_CRTP<
|
19
|
+
class Expand : public Operation_CRTP<Statement_Ptr, Expand> {
|
20
20
|
public:
|
21
21
|
|
22
22
|
Env* environment();
|
23
23
|
Context& context();
|
24
|
-
|
24
|
+
Selector_List_Obj selector();
|
25
25
|
Backtrace* backtrace();
|
26
26
|
|
27
27
|
Context& ctx;
|
28
28
|
Eval eval;
|
29
|
+
size_t recursions;
|
30
|
+
bool in_keyframes;
|
31
|
+
bool at_root_without_rule;
|
32
|
+
bool old_at_root_without_rule;
|
29
33
|
|
30
34
|
// it's easier to work with vectors
|
31
|
-
std::vector<Env*>
|
32
|
-
std::vector<
|
33
|
-
std::vector<
|
34
|
-
std::vector<
|
35
|
-
std::vector<
|
36
|
-
std::vector<
|
37
|
-
|
38
|
-
|
39
|
-
bool at_root_without_rule;
|
40
|
-
bool old_at_root_without_rule;
|
41
|
-
|
42
|
-
Statement* fallback_impl(AST_Node* n);
|
35
|
+
std::vector<Env*> env_stack;
|
36
|
+
std::vector<Block_Ptr> block_stack;
|
37
|
+
std::vector<AST_Node_Obj> call_stack;
|
38
|
+
std::vector<Selector_List_Obj> selector_stack;
|
39
|
+
std::vector<Media_Block_Ptr> media_block_stack;
|
40
|
+
std::vector<Backtrace*> backtrace_stack;
|
41
|
+
|
42
|
+
Statement_Ptr fallback_impl(AST_Node_Ptr n);
|
43
43
|
|
44
44
|
private:
|
45
|
-
void expand_selector_list(
|
45
|
+
void expand_selector_list(Selector_Obj, Selector_List_Obj extender);
|
46
46
|
|
47
47
|
public:
|
48
|
-
Expand(Context&, Env*, Backtrace*, std::vector<
|
48
|
+
Expand(Context&, Env*, Backtrace*, std::vector<Selector_List_Obj>* stack = NULL);
|
49
49
|
~Expand() { }
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
51
|
+
Block_Ptr operator()(Block_Ptr);
|
52
|
+
Statement_Ptr operator()(Ruleset_Ptr);
|
53
|
+
Statement_Ptr operator()(Media_Block_Ptr);
|
54
|
+
Statement_Ptr operator()(Supports_Block_Ptr);
|
55
|
+
Statement_Ptr operator()(At_Root_Block_Ptr);
|
56
|
+
Statement_Ptr operator()(Directive_Ptr);
|
57
|
+
Statement_Ptr operator()(Declaration_Ptr);
|
58
|
+
Statement_Ptr operator()(Assignment_Ptr);
|
59
|
+
Statement_Ptr operator()(Import_Ptr);
|
60
|
+
Statement_Ptr operator()(Import_Stub_Ptr);
|
61
|
+
Statement_Ptr operator()(Warning_Ptr);
|
62
|
+
Statement_Ptr operator()(Error_Ptr);
|
63
|
+
Statement_Ptr operator()(Debug_Ptr);
|
64
|
+
Statement_Ptr operator()(Comment_Ptr);
|
65
|
+
Statement_Ptr operator()(If_Ptr);
|
66
|
+
Statement_Ptr operator()(For_Ptr);
|
67
|
+
Statement_Ptr operator()(Each_Ptr);
|
68
|
+
Statement_Ptr operator()(While_Ptr);
|
69
|
+
Statement_Ptr operator()(Return_Ptr);
|
70
|
+
Statement_Ptr operator()(Extension_Ptr);
|
71
|
+
Statement_Ptr operator()(Definition_Ptr);
|
72
|
+
Statement_Ptr operator()(Mixin_Call_Ptr);
|
73
|
+
Statement_Ptr operator()(Content_Ptr);
|
74
74
|
|
75
75
|
template <typename U>
|
76
|
-
|
76
|
+
Statement_Ptr fallback(U x) { return fallback_impl(x); }
|
77
77
|
|
78
|
-
void append_block(
|
78
|
+
void append_block(Block_Ptr);
|
79
79
|
};
|
80
80
|
|
81
81
|
}
|
data/ext/libsass/src/extend.cpp
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
#include <deque>
|
13
13
|
#include <set>
|
14
14
|
|
15
|
-
|
16
15
|
/*
|
17
16
|
NOTES:
|
18
17
|
|
@@ -62,26 +61,26 @@
|
|
62
61
|
namespace Sass {
|
63
62
|
|
64
63
|
|
65
|
-
typedef std::pair<
|
64
|
+
typedef std::pair<Complex_Selector_Obj, Compound_Selector_Obj> ExtensionPair;
|
66
65
|
typedef std::vector<ExtensionPair> SubsetMapEntries;
|
67
66
|
|
68
67
|
#ifdef DEBUG
|
69
68
|
|
70
69
|
// TODO: move the ast specific ostream operators into ast.hpp/ast.cpp
|
71
|
-
std::ostream& operator<<(std::ostream& os, const
|
70
|
+
std::ostream& operator<<(std::ostream& os, const Complex_Selector::Combinator combinator) {
|
72
71
|
switch (combinator) {
|
73
|
-
case
|
74
|
-
case
|
75
|
-
case
|
76
|
-
case
|
77
|
-
case
|
72
|
+
case Complex_Selector::ANCESTOR_OF: os << "\" \""; break;
|
73
|
+
case Complex_Selector::PARENT_OF: os << "\">\""; break;
|
74
|
+
case Complex_Selector::PRECEDES: os << "\"~\""; break;
|
75
|
+
case Complex_Selector::ADJACENT_TO: os << "\"+\""; break;
|
76
|
+
case Complex_Selector::REFERENCE: os << "\"/\""; break;
|
78
77
|
}
|
79
78
|
|
80
79
|
return os;
|
81
80
|
}
|
82
81
|
|
83
82
|
|
84
|
-
std::ostream& operator<<(std::ostream& os,
|
83
|
+
std::ostream& operator<<(std::ostream& os, Compound_Selector& compoundSelector) {
|
85
84
|
for (size_t i = 0, L = compoundSelector.length(); i < L; ++i) {
|
86
85
|
if (i > 0) os << ", ";
|
87
86
|
os << compoundSelector[i]->to_string();
|
@@ -94,7 +93,7 @@ namespace Sass {
|
|
94
93
|
return os;
|
95
94
|
}
|
96
95
|
|
97
|
-
// Print a string representation of a
|
96
|
+
// Print a string representation of a Compound_Selector
|
98
97
|
static void printSimpleSelector(Simple_Selector* pSimpleSelector, const char* message=NULL, bool newline=true) {
|
99
98
|
|
100
99
|
if (message) {
|
@@ -112,13 +111,13 @@ namespace Sass {
|
|
112
111
|
}
|
113
112
|
}
|
114
113
|
|
115
|
-
// Print a string representation of a
|
116
|
-
typedef std::pair<
|
114
|
+
// Print a string representation of a Compound_Selector
|
115
|
+
typedef std::pair<Compound_Selector_Obj, Complex_Selector_Obj> SelsNewSeqPair;
|
117
116
|
typedef std::vector<SelsNewSeqPair> SelsNewSeqPairCollection;
|
118
117
|
|
119
118
|
|
120
|
-
// Print a string representation of a
|
121
|
-
static void printCompoundSelector(
|
119
|
+
// Print a string representation of a Compound_Selector
|
120
|
+
static void printCompoundSelector(Compound_Selector_Ptr pCompoundSelector, const char* message=NULL, bool newline=true) {
|
122
121
|
|
123
122
|
if (message) {
|
124
123
|
std::cerr << message;
|
@@ -136,13 +135,13 @@ namespace Sass {
|
|
136
135
|
}
|
137
136
|
|
138
137
|
|
139
|
-
std::ostream& operator<<(std::ostream& os,
|
138
|
+
std::ostream& operator<<(std::ostream& os, Complex_Selector& complexSelector) {
|
140
139
|
|
141
140
|
os << "[";
|
142
|
-
|
141
|
+
Complex_Selector_Ptr pIter = &complexSelector;
|
143
142
|
bool first = true;
|
144
143
|
while (pIter) {
|
145
|
-
if (pIter->combinator() !=
|
144
|
+
if (pIter->combinator() != Complex_Selector::ANCESTOR_OF) {
|
146
145
|
if (!first) {
|
147
146
|
os << ", ";
|
148
147
|
}
|
@@ -169,8 +168,8 @@ namespace Sass {
|
|
169
168
|
}
|
170
169
|
|
171
170
|
|
172
|
-
// Print a string representation of a
|
173
|
-
static void printComplexSelector(
|
171
|
+
// Print a string representation of a Complex_Selector
|
172
|
+
static void printComplexSelector(Complex_Selector_Ptr pComplexSelector, const char* message=NULL, bool newline=true) {
|
174
173
|
|
175
174
|
if (message) {
|
176
175
|
std::cerr << message;
|
@@ -201,8 +200,8 @@ namespace Sass {
|
|
201
200
|
std::cerr << ", ";
|
202
201
|
}
|
203
202
|
std::cerr << "[";
|
204
|
-
|
205
|
-
|
203
|
+
Compound_Selector_Ptr pSels = pair.first;
|
204
|
+
Complex_Selector_Ptr pNewSelector = pair.second;
|
206
205
|
std::cerr << "[" << *pSels << "], ";
|
207
206
|
printComplexSelector(pNewSelector, NULL, false);
|
208
207
|
}
|
@@ -225,7 +224,7 @@ namespace Sass {
|
|
225
224
|
typedef std::deque<std::string> SourceStrings;
|
226
225
|
SourceStrings sourceStrings;
|
227
226
|
for (SourcesSet::iterator iterator = sources.begin(), iteratorEnd = sources.end(); iterator != iteratorEnd; ++iterator) {
|
228
|
-
|
227
|
+
Complex_Selector_Ptr pSource = *iterator;
|
229
228
|
std::stringstream sstream;
|
230
229
|
sstream << complexSelectorToNode(pSource, ctx);
|
231
230
|
sourceStrings.push_back(sstream.str());
|
@@ -254,8 +253,8 @@ namespace Sass {
|
|
254
253
|
os << "SUBSET_MAP_ENTRIES[";
|
255
254
|
|
256
255
|
for (SubsetMapEntries::iterator iterator = entries.begin(), endIterator = entries.end(); iterator != endIterator; ++iterator) {
|
257
|
-
|
258
|
-
|
256
|
+
Complex_Selector_Obj pExtComplexSelector = iterator->first; // The selector up to where the @extend is (ie, the thing to merge)
|
257
|
+
Compound_Selector_Obj pExtCompoundSelector = iterator->second; // The stuff after the @extend
|
259
258
|
|
260
259
|
if (iterator != entries.begin()) {
|
261
260
|
os << ", ";
|
@@ -287,17 +286,17 @@ namespace Sass {
|
|
287
286
|
}
|
288
287
|
#endif
|
289
288
|
|
290
|
-
static bool parentSuperselector(
|
291
|
-
// TODO: figure out a better way to create a
|
289
|
+
static bool parentSuperselector(Complex_Selector_Ptr pOne, Complex_Selector_Ptr pTwo, Context& ctx) {
|
290
|
+
// TODO: figure out a better way to create a Complex_Selector from scratch
|
292
291
|
// TODO: There's got to be a better way. This got ugly quick...
|
293
292
|
Position noPosition(-1, -1, -1);
|
294
|
-
|
295
|
-
|
296
|
-
fakeHead
|
297
|
-
|
293
|
+
Element_Selector_Obj fakeParent = SASS_MEMORY_NEW(Element_Selector, ParserState("[FAKE]"), "temp");
|
294
|
+
Compound_Selector_Obj fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[FAKE]"), 1 /*size*/);
|
295
|
+
fakeHead->elements().push_back(&fakeParent);
|
296
|
+
Complex_Selector_Obj fakeParentContainer = SASS_MEMORY_NEW(Complex_Selector, ParserState("[FAKE]"), Complex_Selector::ANCESTOR_OF, &fakeHead /*head*/, NULL /*tail*/);
|
298
297
|
|
299
|
-
pOne->set_innermost(&fakeParentContainer,
|
300
|
-
pTwo->set_innermost(&fakeParentContainer,
|
298
|
+
pOne->set_innermost(&fakeParentContainer, Complex_Selector::ANCESTOR_OF);
|
299
|
+
pTwo->set_innermost(&fakeParentContainer, Complex_Selector::ANCESTOR_OF);
|
301
300
|
|
302
301
|
bool isSuperselector = pOne->is_superselector_of(pTwo);
|
303
302
|
|
@@ -318,8 +317,8 @@ namespace Sass {
|
|
318
317
|
Node result = Node::createCollection();
|
319
318
|
|
320
319
|
for (ComplexSelectorDeque::const_iterator iter = deque.begin(), iterEnd = deque.end(); iter != iterEnd; iter++) {
|
321
|
-
|
322
|
-
result.collection()->push_back(complexSelectorToNode(pChild, ctx));
|
320
|
+
Complex_Selector_Obj pChild = *iter;
|
321
|
+
result.collection()->push_back(complexSelectorToNode(&pChild, ctx));
|
323
322
|
}
|
324
323
|
|
325
324
|
return result;
|
@@ -331,7 +330,7 @@ namespace Sass {
|
|
331
330
|
|
332
331
|
Context& mCtx;
|
333
332
|
|
334
|
-
bool operator()(
|
333
|
+
bool operator()(Complex_Selector_Obj pOne, Complex_Selector_Obj pTwo, Complex_Selector_Obj& pOut) const {
|
335
334
|
/*
|
336
335
|
This code is based on the following block from ruby sass' subweave
|
337
336
|
do |s1, s2|
|
@@ -347,16 +346,16 @@ namespace Sass {
|
|
347
346
|
return true;
|
348
347
|
}
|
349
348
|
|
350
|
-
if (pOne->combinator() !=
|
349
|
+
if (pOne->combinator() != Complex_Selector::ANCESTOR_OF || pTwo->combinator() != Complex_Selector::ANCESTOR_OF) {
|
351
350
|
return false;
|
352
351
|
}
|
353
352
|
|
354
|
-
if (parentSuperselector(pOne, pTwo, mCtx)) {
|
353
|
+
if (parentSuperselector(&pOne, &pTwo, mCtx)) {
|
355
354
|
pOut = pTwo;
|
356
355
|
return true;
|
357
356
|
}
|
358
357
|
|
359
|
-
if (parentSuperselector(pTwo, pOne, mCtx)) {
|
358
|
+
if (parentSuperselector(&pTwo, &pOne, mCtx)) {
|
360
359
|
pOut = pOne;
|
361
360
|
return true;
|
362
361
|
}
|
@@ -382,7 +381,7 @@ namespace Sass {
|
|
382
381
|
}
|
383
382
|
|
384
383
|
|
385
|
-
|
384
|
+
Complex_Selector_Obj pCompareOut;
|
386
385
|
if (comparator(x[i], y[j], pCompareOut)) {
|
387
386
|
DEBUG_PRINTLN(LCS, "RETURNING AFTER ELEM COMPARE")
|
388
387
|
lcs_backtrace(c, x, y, i - 1, j - 1, comparator, out);
|
@@ -419,9 +418,9 @@ namespace Sass {
|
|
419
418
|
|
420
419
|
for (size_t i = 1; i < x.size(); i++) {
|
421
420
|
for (size_t j = 1; j < y.size(); j++) {
|
422
|
-
|
421
|
+
Complex_Selector_Obj pCompareOut;
|
423
422
|
|
424
|
-
if (comparator(x[i], y[j], pCompareOut)) {
|
423
|
+
if (comparator(&x[i], &y[j], pCompareOut)) {
|
425
424
|
c[i][j] = c[i - 1][j - 1] + 1;
|
426
425
|
} else {
|
427
426
|
c[i][j] = std::max(c[i][j - 1], c[i - 1][j]);
|
@@ -559,7 +558,7 @@ namespace Sass {
|
|
559
558
|
for (NodeDeque::iterator seqs1Iter = seqs1.collection()->begin(), seqs1EndIter = seqs1.collection()->end(); seqs1Iter != seqs1EndIter; ++seqs1Iter) {
|
560
559
|
Node& seq1 = *seqs1Iter;
|
561
560
|
|
562
|
-
|
561
|
+
Complex_Selector_Obj pSeq1 = nodeToComplexSelector(seq1, ctx);
|
563
562
|
|
564
563
|
// Compute the maximum specificity. This requires looking at the "sources" of the sequence. See SimpleSequence.sources in the ruby code
|
565
564
|
// for a good description of sources.
|
@@ -576,7 +575,7 @@ namespace Sass {
|
|
576
575
|
DEBUG_EXEC(TRIM, printSourcesSet(sources, ctx, "TRIM SOURCES: "))
|
577
576
|
|
578
577
|
for (SourcesSet::iterator sourcesSetIterator = sources.begin(), sourcesSetIteratorEnd = sources.end(); sourcesSetIterator != sourcesSetIteratorEnd; ++sourcesSetIterator) {
|
579
|
-
const
|
578
|
+
const Complex_Selector_Obj& pCurrentSelector = *sourcesSetIterator;
|
580
579
|
maxSpecificity = std::max(maxSpecificity, pCurrentSelector->specificity());
|
581
580
|
}
|
582
581
|
|
@@ -606,7 +605,7 @@ namespace Sass {
|
|
606
605
|
for (NodeDeque::iterator seqs2Iter = seqs2.collection()->begin(), seqs2IterEnd = seqs2.collection()->end(); seqs2Iter != seqs2IterEnd; ++seqs2Iter) {
|
607
606
|
Node& seq2 = *seqs2Iter;
|
608
607
|
|
609
|
-
|
608
|
+
Complex_Selector_Obj pSeq2 = nodeToComplexSelector(seq2, ctx);
|
610
609
|
|
611
610
|
DEBUG_PRINTLN(TRIM, "SEQ2 SPEC: " << pSeq2->specificity())
|
612
611
|
DEBUG_PRINTLN(TRIM, "IS SPEC: " << pSeq2->specificity() << " >= " << maxSpecificity << " " << (pSeq2->specificity() >= maxSpecificity ? "true" : "false"))
|
@@ -651,18 +650,18 @@ namespace Sass {
|
|
651
650
|
|
652
651
|
|
653
652
|
static bool parentSuperselector(const Node& one, const Node& two, Context& ctx) {
|
654
|
-
// TODO: figure out a better way to create a
|
653
|
+
// TODO: figure out a better way to create a Complex_Selector from scratch
|
655
654
|
// TODO: There's got to be a better way. This got ugly quick...
|
656
655
|
Position noPosition(-1, -1, -1);
|
657
|
-
|
658
|
-
|
659
|
-
fakeHead
|
660
|
-
|
656
|
+
Element_Selector_Obj fakeParent = SASS_MEMORY_NEW(Element_Selector, ParserState("[FAKE]"), "temp");
|
657
|
+
Compound_Selector_Obj fakeHead = SASS_MEMORY_NEW(Compound_Selector, ParserState("[FAKE]"), 1 /*size*/);
|
658
|
+
fakeHead->elements().push_back(&fakeParent);
|
659
|
+
Complex_Selector_Obj fakeParentContainer = SASS_MEMORY_NEW(Complex_Selector, ParserState("[FAKE]"), Complex_Selector::ANCESTOR_OF, &fakeHead /*head*/, NULL /*tail*/);
|
661
660
|
|
662
|
-
|
663
|
-
pOneWithFakeParent->set_innermost(&fakeParentContainer,
|
664
|
-
|
665
|
-
pTwoWithFakeParent->set_innermost(&fakeParentContainer,
|
661
|
+
Complex_Selector_Obj pOneWithFakeParent = nodeToComplexSelector(one, ctx);
|
662
|
+
pOneWithFakeParent->set_innermost(&fakeParentContainer, Complex_Selector::ANCESTOR_OF);
|
663
|
+
Complex_Selector_Obj pTwoWithFakeParent = nodeToComplexSelector(two, ctx);
|
664
|
+
pTwoWithFakeParent->set_innermost(&fakeParentContainer, Complex_Selector::ANCESTOR_OF);
|
666
665
|
|
667
666
|
return pOneWithFakeParent->is_superselector_of(pTwoWithFakeParent);
|
668
667
|
}
|
@@ -849,7 +848,7 @@ namespace Sass {
|
|
849
848
|
DefaultLcsComparator lcsDefaultComparator;
|
850
849
|
Node opsLcs = lcs(ops1, ops2, lcsDefaultComparator, ctx);
|
851
850
|
|
852
|
-
if (!(opsLcs
|
851
|
+
if (!(nodesEqual(opsLcs, ops1, true) || nodesEqual(opsLcs, ops2, true))) {
|
853
852
|
return Node::createNil();
|
854
853
|
}
|
855
854
|
|
@@ -946,7 +945,7 @@ namespace Sass {
|
|
946
945
|
|
947
946
|
// If there are multiple operators, something hacky's going on. If one is a supersequence of the other, use that, otherwise give up.
|
948
947
|
|
949
|
-
if (!(opsLcs
|
948
|
+
if (!(nodesEqual(opsLcs, ops1, true) || nodesEqual(opsLcs, ops2, true))) {
|
950
949
|
return Node::createNil();
|
951
950
|
}
|
952
951
|
|
@@ -970,7 +969,7 @@ namespace Sass {
|
|
970
969
|
Node sel2 = seq2.collection()->back();
|
971
970
|
seq2.collection()->pop_back();
|
972
971
|
|
973
|
-
if (op1.combinator() ==
|
972
|
+
if (op1.combinator() == Complex_Selector::PRECEDES && op2.combinator() == Complex_Selector::PRECEDES) {
|
974
973
|
|
975
974
|
if (sel1.selector()->is_superselector_of(sel2.selector())) {
|
976
975
|
|
@@ -987,9 +986,9 @@ namespace Sass {
|
|
987
986
|
DEBUG_PRINTLN(ALL, "sel1: " << sel1)
|
988
987
|
DEBUG_PRINTLN(ALL, "sel2: " << sel2)
|
989
988
|
|
990
|
-
|
989
|
+
Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(sel1.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result
|
991
990
|
// TODO: does subject matter? Ruby: return unless merged = sel1.unify(sel2.members, sel2.subject?)
|
992
|
-
|
991
|
+
Compound_Selector_Ptr pMerged = sel1.selector()->head()->unify_with(&sel2.selector()->head(), ctx);
|
993
992
|
pMergedWrapper->head(pMerged);
|
994
993
|
|
995
994
|
DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: "))
|
@@ -998,22 +997,22 @@ namespace Sass {
|
|
998
997
|
|
999
998
|
Node firstPerm = Node::createCollection();
|
1000
999
|
firstPerm.collection()->push_back(sel1);
|
1001
|
-
firstPerm.collection()->push_back(Node::createCombinator(
|
1000
|
+
firstPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1002
1001
|
firstPerm.collection()->push_back(sel2);
|
1003
|
-
firstPerm.collection()->push_back(Node::createCombinator(
|
1002
|
+
firstPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1004
1003
|
newRes.collection()->push_back(firstPerm);
|
1005
1004
|
|
1006
1005
|
Node secondPerm = Node::createCollection();
|
1007
1006
|
secondPerm.collection()->push_back(sel2);
|
1008
|
-
secondPerm.collection()->push_back(Node::createCombinator(
|
1007
|
+
secondPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1009
1008
|
secondPerm.collection()->push_back(sel1);
|
1010
|
-
secondPerm.collection()->push_back(Node::createCombinator(
|
1009
|
+
secondPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1011
1010
|
newRes.collection()->push_back(secondPerm);
|
1012
1011
|
|
1013
1012
|
if (pMerged) {
|
1014
1013
|
Node mergedPerm = Node::createCollection();
|
1015
|
-
mergedPerm.collection()->push_back(Node::createSelector(pMergedWrapper, ctx));
|
1016
|
-
mergedPerm.collection()->push_back(Node::createCombinator(
|
1014
|
+
mergedPerm.collection()->push_back(Node::createSelector(&pMergedWrapper, ctx));
|
1015
|
+
mergedPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1017
1016
|
newRes.collection()->push_back(mergedPerm);
|
1018
1017
|
}
|
1019
1018
|
|
@@ -1023,13 +1022,13 @@ namespace Sass {
|
|
1023
1022
|
|
1024
1023
|
}
|
1025
1024
|
|
1026
|
-
} else if (((op1.combinator() ==
|
1025
|
+
} else if (((op1.combinator() == Complex_Selector::PRECEDES && op2.combinator() == Complex_Selector::ADJACENT_TO)) || ((op1.combinator() == Complex_Selector::ADJACENT_TO && op2.combinator() == Complex_Selector::PRECEDES))) {
|
1027
1026
|
|
1028
1027
|
Node tildeSel = sel1;
|
1029
1028
|
Node tildeOp = op1;
|
1030
1029
|
Node plusSel = sel2;
|
1031
1030
|
Node plusOp = op2;
|
1032
|
-
if (op1.combinator() !=
|
1031
|
+
if (op1.combinator() != Complex_Selector::PRECEDES) {
|
1033
1032
|
tildeSel = sel2;
|
1034
1033
|
tildeOp = op2;
|
1035
1034
|
plusSel = sel1;
|
@@ -1046,9 +1045,9 @@ namespace Sass {
|
|
1046
1045
|
DEBUG_PRINTLN(ALL, "PLUS SEL: " << plusSel)
|
1047
1046
|
DEBUG_PRINTLN(ALL, "TILDE SEL: " << tildeSel)
|
1048
1047
|
|
1049
|
-
|
1048
|
+
Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(plusSel.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result
|
1050
1049
|
// TODO: does subject matter? Ruby: merged = plus_sel.unify(tilde_sel.members, tilde_sel.subject?)
|
1051
|
-
|
1050
|
+
Compound_Selector_Ptr pMerged = plusSel.selector()->head()->unify_with(&tildeSel.selector()->head(), ctx);
|
1052
1051
|
pMergedWrapper->head(pMerged);
|
1053
1052
|
|
1054
1053
|
DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: "))
|
@@ -1057,15 +1056,15 @@ namespace Sass {
|
|
1057
1056
|
|
1058
1057
|
Node firstPerm = Node::createCollection();
|
1059
1058
|
firstPerm.collection()->push_back(tildeSel);
|
1060
|
-
firstPerm.collection()->push_back(Node::createCombinator(
|
1059
|
+
firstPerm.collection()->push_back(Node::createCombinator(Complex_Selector::PRECEDES));
|
1061
1060
|
firstPerm.collection()->push_back(plusSel);
|
1062
|
-
firstPerm.collection()->push_back(Node::createCombinator(
|
1061
|
+
firstPerm.collection()->push_back(Node::createCombinator(Complex_Selector::ADJACENT_TO));
|
1063
1062
|
newRes.collection()->push_back(firstPerm);
|
1064
1063
|
|
1065
1064
|
if (pMerged) {
|
1066
1065
|
Node mergedPerm = Node::createCollection();
|
1067
|
-
mergedPerm.collection()->push_back(Node::createSelector(pMergedWrapper, ctx));
|
1068
|
-
mergedPerm.collection()->push_back(Node::createCombinator(
|
1066
|
+
mergedPerm.collection()->push_back(Node::createSelector(&pMergedWrapper, ctx));
|
1067
|
+
mergedPerm.collection()->push_back(Node::createCombinator(Complex_Selector::ADJACENT_TO));
|
1069
1068
|
newRes.collection()->push_back(mergedPerm);
|
1070
1069
|
}
|
1071
1070
|
|
@@ -1074,7 +1073,7 @@ namespace Sass {
|
|
1074
1073
|
DEBUG_PRINTLN(ALL, "RESULT: " << res)
|
1075
1074
|
|
1076
1075
|
}
|
1077
|
-
} else if (op1.combinator() ==
|
1076
|
+
} else if (op1.combinator() == Complex_Selector::PARENT_OF && (op2.combinator() == Complex_Selector::PRECEDES || op2.combinator() == Complex_Selector::ADJACENT_TO)) {
|
1078
1077
|
|
1079
1078
|
res.collection()->push_front(op2);
|
1080
1079
|
res.collection()->push_front(sel2);
|
@@ -1082,7 +1081,7 @@ namespace Sass {
|
|
1082
1081
|
seq1.collection()->push_back(sel1);
|
1083
1082
|
seq1.collection()->push_back(op1);
|
1084
1083
|
|
1085
|
-
} else if (op2.combinator() ==
|
1084
|
+
} else if (op2.combinator() == Complex_Selector::PARENT_OF && (op1.combinator() == Complex_Selector::PRECEDES || op1.combinator() == Complex_Selector::ADJACENT_TO)) {
|
1086
1085
|
|
1087
1086
|
res.collection()->push_front(op1);
|
1088
1087
|
res.collection()->push_front(sel1);
|
@@ -1095,9 +1094,9 @@ namespace Sass {
|
|
1095
1094
|
DEBUG_PRINTLN(ALL, "sel1: " << sel1)
|
1096
1095
|
DEBUG_PRINTLN(ALL, "sel2: " << sel2)
|
1097
1096
|
|
1098
|
-
|
1097
|
+
Complex_Selector_Obj pMergedWrapper = SASS_MEMORY_CLONE(sel1.selector()); // Clone the Complex_Selector to get back to something we can transform to a node once we replace the head with the unification result
|
1099
1098
|
// TODO: does subject matter? Ruby: return unless merged = sel1.unify(sel2.members, sel2.subject?)
|
1100
|
-
|
1099
|
+
Compound_Selector_Ptr pMerged = sel1.selector()->head()->unify_with(&sel2.selector()->head(), ctx);
|
1101
1100
|
pMergedWrapper->head(pMerged);
|
1102
1101
|
|
1103
1102
|
DEBUG_EXEC(ALL, printCompoundSelector(pMerged, "MERGED: "))
|
@@ -1107,7 +1106,7 @@ namespace Sass {
|
|
1107
1106
|
}
|
1108
1107
|
|
1109
1108
|
res.collection()->push_front(op1);
|
1110
|
-
res.collection()->push_front(Node::createSelector(pMergedWrapper, ctx));
|
1109
|
+
res.collection()->push_front(Node::createSelector(&pMergedWrapper, ctx));
|
1111
1110
|
|
1112
1111
|
DEBUG_PRINTLN(ALL, "RESULT: " << res)
|
1113
1112
|
|
@@ -1121,7 +1120,7 @@ namespace Sass {
|
|
1121
1120
|
|
1122
1121
|
Node op1 = ops1.collection()->front();
|
1123
1122
|
|
1124
|
-
if (op1.combinator() ==
|
1123
|
+
if (op1.combinator() == Complex_Selector::PARENT_OF && !seq2.collection()->empty() && seq2.collection()->back().selector()->is_superselector_of(seq1.collection()->back().selector())) {
|
1125
1124
|
seq2.collection()->pop_back();
|
1126
1125
|
}
|
1127
1126
|
|
@@ -1136,7 +1135,7 @@ namespace Sass {
|
|
1136
1135
|
|
1137
1136
|
Node op2 = ops2.collection()->front();
|
1138
1137
|
|
1139
|
-
if (op2.combinator() ==
|
1138
|
+
if (op2.combinator() == Complex_Selector::PARENT_OF && !seq1.collection()->empty() && seq1.collection()->back().selector()->is_superselector_of(seq2.collection()->back().selector())) {
|
1140
1139
|
seq1.collection()->pop_back();
|
1141
1140
|
}
|
1142
1141
|
|
@@ -1354,20 +1353,20 @@ namespace Sass {
|
|
1354
1353
|
|
1355
1354
|
// Check for the simple cases
|
1356
1355
|
if (one.isNil()) {
|
1357
|
-
out.collection()->push_back(two.
|
1356
|
+
out.collection()->push_back(two.klone(ctx));
|
1358
1357
|
} else if (two.isNil()) {
|
1359
|
-
out.collection()->push_back(one.
|
1358
|
+
out.collection()->push_back(one.klone(ctx));
|
1360
1359
|
} else {
|
1361
1360
|
// Do the naive implementation. pOne = A B and pTwo = C D ...yields... A B C D and C D A B
|
1362
1361
|
// See https://gist.github.com/nex3/7609394 for details.
|
1363
1362
|
|
1364
|
-
Node firstPerm = one.
|
1365
|
-
Node twoCloned = two.
|
1363
|
+
Node firstPerm = one.klone(ctx);
|
1364
|
+
Node twoCloned = two.klone(ctx);
|
1366
1365
|
firstPerm.plus(twoCloned);
|
1367
1366
|
out.collection()->push_back(firstPerm);
|
1368
1367
|
|
1369
|
-
Node secondPerm = two.
|
1370
|
-
Node oneCloned = one.
|
1368
|
+
Node secondPerm = two.klone(ctx);
|
1369
|
+
Node oneCloned = one.klone(ctx);
|
1371
1370
|
secondPerm.plus(oneCloned );
|
1372
1371
|
out.collection()->push_back(secondPerm);
|
1373
1372
|
}
|
@@ -1461,7 +1460,7 @@ namespace Sass {
|
|
1461
1460
|
afters.plus(path);
|
1462
1461
|
|
1463
1462
|
while (!afters.collection()->empty()) {
|
1464
|
-
Node current = afters.collection()->front().
|
1463
|
+
Node current = afters.collection()->front().klone(ctx);
|
1465
1464
|
afters.collection()->pop_front();
|
1466
1465
|
DEBUG_PRINTLN(WEAVE, "CURRENT: " << current)
|
1467
1466
|
if (current.collection()->size() == 0) continue;
|
@@ -1509,10 +1508,10 @@ namespace Sass {
|
|
1509
1508
|
// This forward declaration is needed since extendComplexSelector calls extendCompoundSelector, which may recursively
|
1510
1509
|
// call extendComplexSelector again.
|
1511
1510
|
static Node extendComplexSelector(
|
1512
|
-
|
1511
|
+
Complex_Selector_Ptr pComplexSelector,
|
1513
1512
|
Context& ctx,
|
1514
|
-
|
1515
|
-
std::set<
|
1513
|
+
Subset_Map& subset_map,
|
1514
|
+
std::set<Compound_Selector> seen, bool isReplace, bool isOriginal);
|
1516
1515
|
|
1517
1516
|
|
1518
1517
|
|
@@ -1532,15 +1531,15 @@ namespace Sass {
|
|
1532
1531
|
class GroupByToAFunctor {
|
1533
1532
|
public:
|
1534
1533
|
KeyType operator()(ExtensionPair& extPair) const {
|
1535
|
-
|
1536
|
-
return
|
1534
|
+
Complex_Selector_Obj pSelector = extPair.first;
|
1535
|
+
return &pSelector;
|
1537
1536
|
}
|
1538
1537
|
};
|
1539
1538
|
static Node extendCompoundSelector(
|
1540
|
-
|
1539
|
+
Compound_Selector_Ptr pSelector,
|
1541
1540
|
Context& ctx,
|
1542
|
-
|
1543
|
-
std::set<
|
1541
|
+
Subset_Map& subset_map,
|
1542
|
+
std::set<Compound_Selector> seen, bool isReplace) {
|
1544
1543
|
|
1545
1544
|
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSelector, "EXTEND COMPOUND: "))
|
1546
1545
|
// TODO: Ruby has another loop here to skip certain members?
|
@@ -1548,15 +1547,15 @@ namespace Sass {
|
|
1548
1547
|
Node extendedSelectors = Node::createCollection();
|
1549
1548
|
// extendedSelectors.got_line_feed = true;
|
1550
1549
|
|
1551
|
-
SubsetMapEntries entries = subset_map.get_v(pSelector
|
1550
|
+
SubsetMapEntries entries = subset_map.get_v(pSelector);
|
1552
1551
|
|
1553
|
-
typedef std::vector<std::pair<
|
1552
|
+
typedef std::vector<std::pair<Complex_Selector_Obj, std::vector<ExtensionPair> > > GroupedByToAResult;
|
1554
1553
|
|
1555
|
-
GroupByToAFunctor<
|
1554
|
+
GroupByToAFunctor<Complex_Selector_Obj> extPairKeyFunctor;
|
1556
1555
|
GroupedByToAResult arr;
|
1557
1556
|
group_by_to_a(entries, extPairKeyFunctor, arr);
|
1558
1557
|
|
1559
|
-
typedef std::pair<
|
1558
|
+
typedef std::pair<Compound_Selector_Obj, Complex_Selector_Obj> SelsNewSeqPair;
|
1560
1559
|
typedef std::vector<SelsNewSeqPair> SelsNewSeqPairCollection;
|
1561
1560
|
|
1562
1561
|
|
@@ -1564,46 +1563,42 @@ namespace Sass {
|
|
1564
1563
|
|
1565
1564
|
|
1566
1565
|
for (GroupedByToAResult::iterator groupedIter = arr.begin(), groupedIterEnd = arr.end(); groupedIter != groupedIterEnd; groupedIter++) {
|
1567
|
-
std::pair<
|
1566
|
+
std::pair<Complex_Selector_Obj, std::vector<ExtensionPair> >& groupedPair = *groupedIter;
|
1568
1567
|
|
1569
|
-
|
1568
|
+
Complex_Selector_Obj seq = groupedPair.first;
|
1570
1569
|
std::vector<ExtensionPair>& group = groupedPair.second;
|
1571
1570
|
|
1572
1571
|
DEBUG_EXEC(EXTEND_COMPOUND, printComplexSelector(&seq, "SEQ: "))
|
1573
1572
|
|
1574
|
-
|
1575
|
-
|
1573
|
+
// changing this makes aua
|
1574
|
+
Compound_Selector_Obj pSels = SASS_MEMORY_NEW(Compound_Selector, pSelector->pstate());
|
1576
1575
|
for (std::vector<ExtensionPair>::iterator groupIter = group.begin(), groupIterEnd = group.end(); groupIter != groupIterEnd; groupIter++) {
|
1577
1576
|
ExtensionPair& pair = *groupIter;
|
1578
|
-
|
1577
|
+
Compound_Selector_Obj pCompound = pair.second;
|
1579
1578
|
for (size_t index = 0; index < pCompound->length(); index++) {
|
1580
|
-
|
1581
|
-
(
|
1579
|
+
Simple_Selector_Obj pSimpleSelector = (*pCompound)[index];
|
1580
|
+
pSels->append(&pSimpleSelector);
|
1582
1581
|
pCompound->extended(true);
|
1583
1582
|
}
|
1584
1583
|
}
|
1585
1584
|
|
1586
|
-
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSels, "SELS: "))
|
1585
|
+
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(&pSels, "SELS: "))
|
1587
1586
|
|
1588
|
-
|
1589
|
-
SimpleSequence_Selector* pExtCompoundSelector = pSels; // All the simple selectors to be replaced from the current compound selector from all extensions
|
1587
|
+
Complex_Selector_Ptr pExtComplexSelector = &seq; // The selector up to where the @extend is (ie, the thing to merge)
|
1590
1588
|
|
1591
|
-
// TODO: This can return a
|
1589
|
+
// TODO: This can return a Compound_Selector with no elements. Should that just be returning NULL?
|
1592
1590
|
// RUBY: self_without_sel = Sass::Util.array_minus(members, sels)
|
1593
|
-
|
1591
|
+
Compound_Selector_Obj pSelectorWithoutExtendSelectors = pSelector->minus(&pSels, ctx);
|
1594
1592
|
|
1595
1593
|
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSelector, "MEMBERS: "))
|
1596
1594
|
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSelectorWithoutExtendSelectors, "SELF_WO_SEL: "))
|
1597
1595
|
|
1598
|
-
|
1599
|
-
SimpleSequence_Selector* pUnifiedSelector = NULL;
|
1596
|
+
Compound_Selector_Obj pInnermostCompoundSelector = pExtComplexSelector->last()->head();
|
1600
1597
|
|
1601
1598
|
if (!pInnermostCompoundSelector) {
|
1602
|
-
pInnermostCompoundSelector = SASS_MEMORY_NEW(
|
1599
|
+
pInnermostCompoundSelector = SASS_MEMORY_NEW(Compound_Selector, pSelector->pstate());
|
1603
1600
|
}
|
1604
|
-
|
1605
|
-
pUnifiedSelector = pInnermostCompoundSelector->unify_with(pSelectorWithoutExtendSelectors, ctx);
|
1606
|
-
|
1601
|
+
Compound_Selector_Obj pUnifiedSelector = pInnermostCompoundSelector->unify_with(&pSelectorWithoutExtendSelectors, ctx);
|
1607
1602
|
|
1608
1603
|
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pInnermostCompoundSelector, "LHS: "))
|
1609
1604
|
DEBUG_EXEC(EXTEND_COMPOUND, printCompoundSelector(pSelectorWithoutExtendSelectors, "RHS: "))
|
@@ -1618,31 +1613,31 @@ namespace Sass {
|
|
1618
1613
|
// next if group.map {|e, _| check_directives_match!(e, parent_directives)}.none?
|
1619
1614
|
|
1620
1615
|
// TODO: This seems a little fishy to me. See if it causes any problems. From the ruby, we should be able to just
|
1621
|
-
// get rid of the last
|
1622
|
-
// complex is that
|
1616
|
+
// get rid of the last Compound_Selector and replace it with this one. I think the reason this code is more
|
1617
|
+
// complex is that Complex_Selector contains a combinator, but in ruby combinators have already been filtered
|
1623
1618
|
// out and aren't operated on.
|
1624
|
-
|
1619
|
+
Complex_Selector_Obj pNewSelector = SASS_MEMORY_CLONE(pExtComplexSelector); // ->first();
|
1625
1620
|
|
1626
|
-
|
1621
|
+
Complex_Selector_Obj pNewInnerMost = SASS_MEMORY_NEW(Complex_Selector, pSelector->pstate(), Complex_Selector::ANCESTOR_OF, pUnifiedSelector, NULL);
|
1627
1622
|
|
1628
|
-
|
1629
|
-
pNewSelector->set_innermost(pNewInnerMost, combinator);
|
1623
|
+
Complex_Selector::Combinator combinator = pNewSelector->clear_innermost();
|
1624
|
+
pNewSelector->set_innermost(&pNewInnerMost, combinator);
|
1630
1625
|
|
1631
1626
|
#ifdef DEBUG
|
1632
1627
|
SourcesSet debugSet;
|
1633
1628
|
debugSet = pNewSelector->sources();
|
1634
1629
|
if (debugSet.size() > 0) {
|
1635
|
-
throw "The new selector should start with no sources. Something needs to be cloned to fix this.";
|
1630
|
+
throw std::runtime_error("The new selector should start with no sources. Something needs to be cloned to fix this.");
|
1636
1631
|
}
|
1637
1632
|
debugSet = pExtComplexSelector->sources();
|
1638
1633
|
if (debugSet.size() > 0) {
|
1639
|
-
throw "The extension selector from our subset map should not have sources. These will bleed to the new selector. Something needs to be cloned to fix this.";
|
1634
|
+
throw std::runtime_error("The extension selector from our subset map should not have sources. These will bleed to the new selector. Something needs to be cloned to fix this.");
|
1640
1635
|
}
|
1641
1636
|
#endif
|
1642
1637
|
|
1643
1638
|
|
1644
1639
|
// if (pSelector && pSelector->has_line_feed()) pNewInnerMost->has_line_feed(true);
|
1645
|
-
// Set the sources on our new
|
1640
|
+
// Set the sources on our new Complex_Selector to the sources of this simple sequence plus the thing we're extending.
|
1646
1641
|
DEBUG_PRINTLN(EXTEND_COMPOUND, "SOURCES SETTING ON NEW SEQ: " << complexSelectorToNode(pNewSelector, ctx))
|
1647
1642
|
|
1648
1643
|
DEBUG_EXEC(EXTEND_COMPOUND, SourcesSet oldSet = pNewSelector->sources(); printSourcesSet(oldSet, ctx, "SOURCES NEW SEQ BEGIN: "))
|
@@ -1660,7 +1655,7 @@ namespace Sass {
|
|
1660
1655
|
DEBUG_EXEC(EXTEND_COMPOUND, printSourcesSet(pSelector->sources(), ctx, "SOURCES THIS EXTEND WHICH SHOULD BE SAME STILL: "))
|
1661
1656
|
|
1662
1657
|
|
1663
|
-
if (pSels->has_line_feed()) pNewSelector->has_line_feed(true)
|
1658
|
+
if (pSels->has_line_feed()) pNewSelector->has_line_feed(true);
|
1664
1659
|
|
1665
1660
|
holder.push_back(std::make_pair(pSels, pNewSelector));
|
1666
1661
|
}
|
@@ -1669,8 +1664,8 @@ namespace Sass {
|
|
1669
1664
|
for (SelsNewSeqPairCollection::iterator holderIter = holder.begin(), holderIterEnd = holder.end(); holderIter != holderIterEnd; holderIter++) {
|
1670
1665
|
SelsNewSeqPair& pair = *holderIter;
|
1671
1666
|
|
1672
|
-
|
1673
|
-
|
1667
|
+
Compound_Selector_Obj pSels = pair.first;
|
1668
|
+
Complex_Selector_Obj pNewSelector = pair.second;
|
1674
1669
|
|
1675
1670
|
|
1676
1671
|
// RUBY??: next [] if seen.include?(sels)
|
@@ -1679,18 +1674,18 @@ namespace Sass {
|
|
1679
1674
|
}
|
1680
1675
|
|
1681
1676
|
|
1682
|
-
std::set<
|
1677
|
+
std::set<Compound_Selector> recurseSeen(seen);
|
1683
1678
|
recurseSeen.insert(*pSels);
|
1684
1679
|
|
1685
1680
|
|
1686
1681
|
DEBUG_PRINTLN(EXTEND_COMPOUND, "RECURSING DO EXTEND: " << complexSelectorToNode(pNewSelector, ctx))
|
1687
|
-
Node recurseExtendedSelectors = extendComplexSelector(pNewSelector, ctx, subset_map, recurseSeen, isReplace, false); // !:isOriginal
|
1682
|
+
Node recurseExtendedSelectors = extendComplexSelector(&pNewSelector, ctx, subset_map, recurseSeen, isReplace, false); // !:isOriginal
|
1688
1683
|
|
1689
1684
|
DEBUG_PRINTLN(EXTEND_COMPOUND, "RECURSING DO EXTEND RETURN: " << recurseExtendedSelectors)
|
1690
1685
|
|
1691
1686
|
for (NodeDeque::iterator iterator = recurseExtendedSelectors.collection()->begin(), endIterator = recurseExtendedSelectors.collection()->end();
|
1692
1687
|
iterator != endIterator; ++iterator) {
|
1693
|
-
Node
|
1688
|
+
Node newSelector = *iterator;
|
1694
1689
|
|
1695
1690
|
// DEBUG_PRINTLN(EXTEND_COMPOUND, "EXTENDED AT THIS POINT: " << extendedSelectors)
|
1696
1691
|
// DEBUG_PRINTLN(EXTEND_COMPOUND, "SELECTOR EXISTS ALREADY: " << newSelector << " " << extendedSelectors.contains(newSelector, false /*simpleSelectorOrderDependent*/));
|
@@ -1709,20 +1704,20 @@ namespace Sass {
|
|
1709
1704
|
|
1710
1705
|
|
1711
1706
|
static bool complexSelectorHasExtension(
|
1712
|
-
|
1707
|
+
Complex_Selector_Ptr pComplexSelector,
|
1713
1708
|
Context& ctx,
|
1714
|
-
|
1715
|
-
std::set<
|
1709
|
+
Subset_Map& subset_map,
|
1710
|
+
std::set<Compound_Selector>& seen) {
|
1716
1711
|
|
1717
1712
|
bool hasExtension = false;
|
1718
1713
|
|
1719
|
-
|
1714
|
+
Complex_Selector_Obj pIter = pComplexSelector;
|
1720
1715
|
|
1721
1716
|
while (!hasExtension && pIter) {
|
1722
|
-
|
1717
|
+
Compound_Selector_Obj pHead = pIter->head();
|
1723
1718
|
|
1724
1719
|
if (pHead) {
|
1725
|
-
SubsetMapEntries entries = subset_map.get_v(pHead
|
1720
|
+
SubsetMapEntries entries = subset_map.get_v(pHead);
|
1726
1721
|
for (ExtensionPair ext : entries) {
|
1727
1722
|
// check if both selectors have the same media block parent
|
1728
1723
|
// if (ext.first->media_block() == pComplexSelector->media_block()) continue;
|
@@ -1769,10 +1764,10 @@ namespace Sass {
|
|
1769
1764
|
next [[sseq_or_op]] unless sseq_or_op.is_a?(SimpleSequence)
|
1770
1765
|
*/
|
1771
1766
|
static Node extendComplexSelector(
|
1772
|
-
|
1767
|
+
Complex_Selector_Ptr pComplexSelector,
|
1773
1768
|
Context& ctx,
|
1774
|
-
|
1775
|
-
std::set<
|
1769
|
+
Subset_Map& subset_map,
|
1770
|
+
std::set<Compound_Selector> seen, bool isReplace, bool isOriginal) {
|
1776
1771
|
|
1777
1772
|
Node complexSelector = complexSelectorToNode(pComplexSelector, ctx);
|
1778
1773
|
DEBUG_PRINTLN(EXTEND_COMPLEX, "EXTEND COMPLEX: " << complexSelector)
|
@@ -1792,7 +1787,7 @@ namespace Sass {
|
|
1792
1787
|
// RUBY: next [[sseq_or_op]] unless sseq_or_op.is_a?(SimpleSequence)
|
1793
1788
|
if (!sseqOrOp.isSelector()) {
|
1794
1789
|
// Wrap our Combinator in two collections to match ruby. This is essentially making a collection Node
|
1795
|
-
// with one collection child. The collection child represents a
|
1790
|
+
// with one collection child. The collection child represents a Complex_Selector that is only a combinator.
|
1796
1791
|
Node outer = Node::createCollection();
|
1797
1792
|
Node inner = Node::createCollection();
|
1798
1793
|
outer.collection()->push_back(inner);
|
@@ -1801,17 +1796,17 @@ namespace Sass {
|
|
1801
1796
|
continue;
|
1802
1797
|
}
|
1803
1798
|
|
1804
|
-
|
1799
|
+
Compound_Selector_Obj pCompoundSelector = sseqOrOp.selector()->head();
|
1805
1800
|
|
1806
1801
|
// RUBY: extended = sseq_or_op.do_extend(extends, parent_directives, replace, seen)
|
1807
|
-
Node extended = extendCompoundSelector(pCompoundSelector, ctx, subset_map, seen, isReplace);
|
1802
|
+
Node extended = extendCompoundSelector(&pCompoundSelector, ctx, subset_map, seen, isReplace);
|
1808
1803
|
if (sseqOrOp.got_line_feed) extended.got_line_feed = true;
|
1809
1804
|
DEBUG_PRINTLN(EXTEND_COMPLEX, "EXTENDED: " << extended)
|
1810
1805
|
|
1811
1806
|
|
1812
|
-
// Prepend the
|
1807
|
+
// Prepend the Compound_Selector based on the choices logic; choices seems to be extend but with an ruby Array instead of a Sequence
|
1813
1808
|
// due to the member mapping: choices = extended.map {|seq| seq.members}
|
1814
|
-
|
1809
|
+
Complex_Selector_Obj pJustCurrentCompoundSelector = sseqOrOp.selector();
|
1815
1810
|
|
1816
1811
|
// RUBY: extended.first.add_sources!([self]) if original && !has_placeholder?
|
1817
1812
|
if (isOriginal && !pComplexSelector->has_placeholder()) {
|
@@ -1825,7 +1820,7 @@ namespace Sass {
|
|
1825
1820
|
for (NodeDeque::iterator iterator = extended.collection()->begin(), endIterator = extended.collection()->end();
|
1826
1821
|
iterator != endIterator; ++iterator) {
|
1827
1822
|
Node& childNode = *iterator;
|
1828
|
-
|
1823
|
+
Complex_Selector_Obj pExtensionSelector = nodeToComplexSelector(childNode, ctx);
|
1829
1824
|
if (pExtensionSelector->is_superselector_of(pJustCurrentCompoundSelector)) {
|
1830
1825
|
isSuperselector = true;
|
1831
1826
|
break;
|
@@ -1834,7 +1829,7 @@ namespace Sass {
|
|
1834
1829
|
|
1835
1830
|
if (!isSuperselector) {
|
1836
1831
|
if (sseqOrOp.got_line_feed) pJustCurrentCompoundSelector->has_line_feed(sseqOrOp.got_line_feed);
|
1837
|
-
extended.collection()->push_front(complexSelectorToNode(pJustCurrentCompoundSelector, ctx));
|
1832
|
+
extended.collection()->push_front(complexSelectorToNode(&pJustCurrentCompoundSelector, ctx));
|
1838
1833
|
}
|
1839
1834
|
|
1840
1835
|
DEBUG_PRINTLN(EXTEND_COMPLEX, "CHOICES UNSHIFTED: " << extended)
|
@@ -1892,39 +1887,39 @@ namespace Sass {
|
|
1892
1887
|
/*
|
1893
1888
|
This is the equivalent of ruby's CommaSequence.do_extend.
|
1894
1889
|
*/
|
1895
|
-
|
1896
|
-
std::set<
|
1890
|
+
Selector_List_Ptr Extend::extendSelectorList(Selector_List_Obj pSelectorList, Context& ctx, Subset_Map& subset_map, bool isReplace, bool& extendedSomething) {
|
1891
|
+
std::set<Compound_Selector> seen;
|
1897
1892
|
return extendSelectorList(pSelectorList, ctx, subset_map, isReplace, extendedSomething, seen);
|
1898
1893
|
}
|
1899
1894
|
|
1900
1895
|
/*
|
1901
1896
|
This is the equivalent of ruby's CommaSequence.do_extend.
|
1902
1897
|
*/
|
1903
|
-
|
1898
|
+
Selector_List_Ptr Extend::extendSelectorList(Selector_List_Obj pSelectorList, Context& ctx, Subset_Map& subset_map, bool isReplace, bool& extendedSomething, std::set<Compound_Selector>& seen) {
|
1904
1899
|
|
1905
|
-
|
1900
|
+
Selector_List_Obj pNewSelectors = SASS_MEMORY_NEW(Selector_List, pSelectorList->pstate(), pSelectorList->length());
|
1906
1901
|
|
1907
1902
|
extendedSomething = false;
|
1908
1903
|
|
1909
1904
|
for (size_t index = 0, length = pSelectorList->length(); index < length; index++) {
|
1910
|
-
|
1905
|
+
Complex_Selector_Obj pSelector = (*pSelectorList)[index];
|
1911
1906
|
|
1912
1907
|
// ruby sass seems to keep a list of things that have extensions and then only extend those. We don't currently do that.
|
1913
1908
|
// Since it's not that expensive to check if an extension exists in the subset map and since it can be relatively expensive to
|
1914
1909
|
// run through the extend code (which does a data model transformation), check if there is anything to extend before doing
|
1915
1910
|
// the extend. We might be able to optimize extendComplexSelector, but this approach keeps us closer to ruby sass (which helps
|
1916
1911
|
// when debugging).
|
1917
|
-
if (!complexSelectorHasExtension(pSelector, ctx, subset_map, seen)) {
|
1918
|
-
|
1912
|
+
if (!complexSelectorHasExtension(&pSelector, ctx, subset_map, seen)) {
|
1913
|
+
pNewSelectors->append(&pSelector);
|
1919
1914
|
continue;
|
1920
1915
|
}
|
1921
1916
|
|
1922
1917
|
extendedSomething = true;
|
1923
1918
|
|
1924
|
-
Node extendedSelectors = extendComplexSelector(pSelector, ctx, subset_map, seen, isReplace, true);
|
1919
|
+
Node extendedSelectors = extendComplexSelector(&pSelector, ctx, subset_map, seen, isReplace, true);
|
1925
1920
|
if (!pSelector->has_placeholder()) {
|
1926
|
-
if (!extendedSelectors.contains(complexSelectorToNode(pSelector, ctx), true /*simpleSelectorOrderDependent*/)) {
|
1927
|
-
|
1921
|
+
if (!extendedSelectors.contains(complexSelectorToNode(&pSelector, ctx), true /*simpleSelectorOrderDependent*/)) {
|
1922
|
+
pNewSelectors->append(pSelector);
|
1928
1923
|
continue;
|
1929
1924
|
}
|
1930
1925
|
}
|
@@ -1934,68 +1929,69 @@ namespace Sass {
|
|
1934
1929
|
if(isReplace && iterator == iteratorBegin && extendedSelectors.collection()->size() > 1 ) continue;
|
1935
1930
|
|
1936
1931
|
Node& childNode = *iterator;
|
1937
|
-
|
1932
|
+
pNewSelectors->append(nodeToComplexSelector(childNode, ctx));
|
1938
1933
|
}
|
1939
1934
|
}
|
1940
1935
|
|
1941
1936
|
Remove_Placeholders remove_placeholders(ctx);
|
1942
1937
|
// it seems that we have to remove the place holders early here
|
1943
1938
|
// normally we do this as the very last step (compare to ruby sass)
|
1944
|
-
pNewSelectors = remove_placeholders.remove_placeholders(pNewSelectors);
|
1939
|
+
pNewSelectors = remove_placeholders.remove_placeholders(&pNewSelectors);
|
1945
1940
|
|
1946
1941
|
// unwrap all wrapped selectors with inner lists
|
1947
|
-
for (
|
1942
|
+
for (Complex_Selector_Obj cur : pNewSelectors->elements()) {
|
1948
1943
|
// process tails
|
1949
1944
|
while (cur) {
|
1950
1945
|
// process header
|
1951
1946
|
if (cur->head() && seen.find(*cur->head()) == seen.end()) {
|
1952
|
-
std::set<
|
1947
|
+
std::set<Compound_Selector> recseen(seen);
|
1953
1948
|
recseen.insert(*cur->head());
|
1954
1949
|
// create a copy since we add multiple items if stuff get unwrapped
|
1955
|
-
|
1956
|
-
for (
|
1957
|
-
if (
|
1958
|
-
|
1950
|
+
Compound_Selector_Obj cpy_head = SASS_MEMORY_NEW(Compound_Selector, cur->pstate());
|
1951
|
+
for (Simple_Selector_Obj hs : *cur->head()) {
|
1952
|
+
if (Wrapped_Selector_Obj ws = SASS_MEMORY_CAST(Wrapped_Selector, hs)) {
|
1953
|
+
ws->selector(SASS_MEMORY_CLONE(ws->selector()));
|
1954
|
+
if (Selector_List_Obj sl = SASS_MEMORY_CAST(Selector_List, ws->selector())) {
|
1959
1955
|
// special case for ruby ass
|
1960
1956
|
if (sl->empty()) {
|
1961
1957
|
// this seems inconsistent but it is how ruby sass seems to remove parentheses
|
1962
|
-
|
1958
|
+
cpy_head->append(SASS_MEMORY_NEW(Element_Selector, hs->pstate(), ws->name()));
|
1963
1959
|
}
|
1964
1960
|
// has wrapped selectors
|
1965
1961
|
else {
|
1966
1962
|
// extend the inner list of wrapped selector
|
1967
|
-
|
1963
|
+
Selector_List_Obj ext_sl = extendSelectorList(sl, ctx, subset_map, recseen);
|
1968
1964
|
for (size_t i = 0; i < ext_sl->length(); i += 1) {
|
1969
|
-
if (
|
1965
|
+
if (Complex_Selector_Obj ext_cs = ext_sl->at(i)) {
|
1970
1966
|
// create clones for wrapped selector and the inner list
|
1971
|
-
|
1972
|
-
|
1967
|
+
Wrapped_Selector_Obj cpy_ws = SASS_MEMORY_COPY(&ws);
|
1968
|
+
Selector_List_Obj cpy_ws_sl = SASS_MEMORY_NEW(Selector_List, sl->pstate());
|
1973
1969
|
// remove parent selectors from inner selector
|
1974
1970
|
if (ext_cs->first() && ext_cs->first()->head()->length() > 0) {
|
1975
|
-
|
1971
|
+
Wrapped_Selector_Ptr ext_ws = SASS_MEMORY_CAST(Wrapped_Selector, ext_cs->first()->head()->first());
|
1976
1972
|
if (ext_ws/* && ext_cs->length() == 1*/) {
|
1977
|
-
|
1978
|
-
|
1973
|
+
Selector_List_Obj ws_cs = SASS_MEMORY_CAST(Selector_List, ext_ws->selector());
|
1974
|
+
Compound_Selector_Obj ws_ss = ws_cs->first()->head();
|
1979
1975
|
if (!(
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1976
|
+
SASS_MEMORY_CAST(Pseudo_Selector, ws_ss->first()) ||
|
1977
|
+
SASS_MEMORY_CAST(Element_Selector, ws_ss->first()) ||
|
1978
|
+
SASS_MEMORY_CAST(Placeholder_Selector, ws_ss->first())
|
1983
1979
|
)) continue;
|
1984
1980
|
}
|
1985
|
-
|
1981
|
+
cpy_ws_sl->append(ext_cs->first());
|
1986
1982
|
}
|
1987
1983
|
// assign list to clone
|
1988
|
-
cpy_ws->selector(cpy_ws_sl);
|
1984
|
+
cpy_ws->selector(&cpy_ws_sl);
|
1989
1985
|
// append the clone
|
1990
|
-
|
1986
|
+
cpy_head->append(&cpy_ws);
|
1991
1987
|
}
|
1992
1988
|
}
|
1993
1989
|
}
|
1994
1990
|
} else {
|
1995
|
-
|
1991
|
+
cpy_head->append(&hs);
|
1996
1992
|
}
|
1997
1993
|
} else {
|
1998
|
-
|
1994
|
+
cpy_head->append(&hs);
|
1999
1995
|
}
|
2000
1996
|
}
|
2001
1997
|
// replace header
|
@@ -2005,12 +2001,12 @@ namespace Sass {
|
|
2005
2001
|
cur = cur->tail();
|
2006
2002
|
}
|
2007
2003
|
}
|
2008
|
-
return pNewSelectors;
|
2004
|
+
return pNewSelectors.detach();
|
2009
2005
|
|
2010
2006
|
}
|
2011
2007
|
|
2012
2008
|
|
2013
|
-
bool shouldExtendBlock(
|
2009
|
+
bool shouldExtendBlock(Block_Obj b) {
|
2014
2010
|
|
2015
2011
|
// If a block is empty, there's no reason to extend it since any rules placed on this block
|
2016
2012
|
// won't have any output. The main benefit of this is for structures like:
|
@@ -2026,9 +2022,9 @@ namespace Sass {
|
|
2026
2022
|
// there are no child statements. However .a .b should have extensions applied.
|
2027
2023
|
|
2028
2024
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
2029
|
-
|
2025
|
+
Statement_Obj stm = b->at(i);
|
2030
2026
|
|
2031
|
-
if (
|
2027
|
+
if (dynamic_cast<Ruleset_Ptr>(&stm)) {
|
2032
2028
|
// Do nothing. This doesn't count as a statement that causes extension since we'll iterate over this rule set in a future visit and try to extend it.
|
2033
2029
|
}
|
2034
2030
|
else {
|
@@ -2043,9 +2039,9 @@ namespace Sass {
|
|
2043
2039
|
|
2044
2040
|
// Extend a ruleset by extending the selectors and updating them on the ruleset. The block's rules don't need to change.
|
2045
2041
|
template <typename ObjectType>
|
2046
|
-
static void extendObjectWithSelectorAndBlock(ObjectType* pObject, Context& ctx,
|
2042
|
+
static void extendObjectWithSelectorAndBlock(ObjectType* pObject, Context& ctx, Subset_Map& subset_map) {
|
2047
2043
|
|
2048
|
-
DEBUG_PRINTLN(EXTEND_OBJECT, "FOUND SELECTOR: " << static_cast<
|
2044
|
+
DEBUG_PRINTLN(EXTEND_OBJECT, "FOUND SELECTOR: " << static_cast<Selector_List_Ptr>(pObject->selector())->to_string(ctx.c_options))
|
2049
2045
|
|
2050
2046
|
// Ruby sass seems to filter nodes that don't have any content well before we get here. I'm not sure the repercussions
|
2051
2047
|
// of doing so, so for now, let's just not extend things that won't be output later.
|
@@ -2055,13 +2051,13 @@ namespace Sass {
|
|
2055
2051
|
}
|
2056
2052
|
|
2057
2053
|
bool extendedSomething = false;
|
2058
|
-
|
2054
|
+
Selector_List_Obj pNewSelectorList = Extend::extendSelectorList(SASS_MEMORY_CAST(Selector_List, pObject->selector()), ctx, subset_map, false, extendedSomething);
|
2059
2055
|
|
2060
2056
|
if (extendedSomething && pNewSelectorList) {
|
2061
|
-
DEBUG_PRINTLN(EXTEND_OBJECT, "EXTEND ORIGINAL SELECTORS: " << static_cast<
|
2057
|
+
DEBUG_PRINTLN(EXTEND_OBJECT, "EXTEND ORIGINAL SELECTORS: " << static_cast<Selector_List_Ptr>(pObject->selector())->to_string(ctx.c_options))
|
2062
2058
|
DEBUG_PRINTLN(EXTEND_OBJECT, "EXTEND SETTING NEW SELECTORS: " << pNewSelectorList->to_string(ctx.c_options))
|
2063
2059
|
pNewSelectorList->remove_parent_selectors();
|
2064
|
-
pObject->selector(pNewSelectorList);
|
2060
|
+
pObject->selector(&pNewSelectorList);
|
2065
2061
|
} else {
|
2066
2062
|
DEBUG_PRINTLN(EXTEND_OBJECT, "EXTEND DID NOT TRY TO EXTEND ANYTHING")
|
2067
2063
|
}
|
@@ -2069,22 +2065,23 @@ namespace Sass {
|
|
2069
2065
|
|
2070
2066
|
|
2071
2067
|
|
2072
|
-
Extend::Extend(Context& ctx,
|
2068
|
+
Extend::Extend(Context& ctx, Subset_Map& ssm)
|
2073
2069
|
: ctx(ctx), subset_map(ssm)
|
2074
2070
|
{ }
|
2075
2071
|
|
2076
|
-
void Extend::operator()(
|
2072
|
+
void Extend::operator()(Block_Ptr b)
|
2077
2073
|
{
|
2078
2074
|
for (size_t i = 0, L = b->length(); i < L; ++i) {
|
2079
|
-
|
2075
|
+
Statement_Obj stm = b->at(i);
|
2076
|
+
stm->perform(this);
|
2080
2077
|
}
|
2081
2078
|
// do final check if everything was extended
|
2082
2079
|
// we set `extended` flag on extended selectors
|
2083
2080
|
if (b->is_root()) {
|
2084
2081
|
// debug_subset_map(subset_map);
|
2085
2082
|
for(auto const &it : subset_map.values()) {
|
2086
|
-
|
2087
|
-
|
2083
|
+
Complex_Selector_Ptr sel = it.first ? &it.first->first() : NULL;
|
2084
|
+
Compound_Selector_Ptr ext = it.second ? &it.second : NULL;
|
2088
2085
|
if (ext && (ext->extended() || ext->is_optional())) continue;
|
2089
2086
|
std::string str_sel(sel->to_string({ NESTED, 5 }));
|
2090
2087
|
std::string str_ext(ext->to_string({ NESTED, 5 }));
|
@@ -2099,25 +2096,25 @@ namespace Sass {
|
|
2099
2096
|
|
2100
2097
|
}
|
2101
2098
|
|
2102
|
-
void Extend::operator()(
|
2099
|
+
void Extend::operator()(Ruleset_Ptr pRuleset)
|
2103
2100
|
{
|
2104
|
-
extendObjectWithSelectorAndBlock(pRuleset, ctx, subset_map);
|
2101
|
+
extendObjectWithSelectorAndBlock( pRuleset, ctx, subset_map);
|
2105
2102
|
pRuleset->block()->perform(this);
|
2106
2103
|
}
|
2107
2104
|
|
2108
|
-
void Extend::operator()(
|
2105
|
+
void Extend::operator()(Supports_Block_Ptr pFeatureBlock)
|
2109
2106
|
{
|
2110
2107
|
pFeatureBlock->block()->perform(this);
|
2111
2108
|
}
|
2112
2109
|
|
2113
|
-
void Extend::operator()(
|
2110
|
+
void Extend::operator()(Media_Block_Ptr pMediaBlock)
|
2114
2111
|
{
|
2115
2112
|
pMediaBlock->block()->perform(this);
|
2116
2113
|
}
|
2117
2114
|
|
2118
|
-
void Extend::operator()(
|
2115
|
+
void Extend::operator()(Directive_Ptr a)
|
2119
2116
|
{
|
2120
|
-
//
|
2117
|
+
// Selector_List_Ptr ls = dynamic_cast<Selector_List_Ptr>(a->selector());
|
2121
2118
|
// selector_stack.push_back(ls);
|
2122
2119
|
if (a->block()) a->block()->perform(this);
|
2123
2120
|
// exp.selector_stack.pop_back();
|