Skip to content

Commit f8074a0

Browse files
committed
Clean up white-space in code
1 parent aa5043d commit f8074a0

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

ast.cpp

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ namespace Sass {
2626
}
2727

2828
bool Complex_Selector::operator==(const Complex_Selector& rhs) const {
29-
// TODO: We have to access the tail directly using tail_ since ADD_PROPERTY doesn't provide a const version.
29+
// TODO: We have to access the tail directly using tail_ since ADD_PROPERTY doesn't provide a const version.
3030

31-
const Complex_Selector* pOne = this;
31+
const Complex_Selector* pOne = this;
3232
const Complex_Selector* pTwo = &rhs;
3333

3434
// Consume any empty references at the beginning of the Complex_Selector
3535
if (pOne->combinator() == Complex_Selector::ANCESTOR_OF && pOne->head()->is_empty_reference()) {
36-
pOne = pOne->tail_;
36+
pOne = pOne->tail_;
3737
}
3838
if (pTwo->combinator() == Complex_Selector::ANCESTOR_OF && pTwo->head()->is_empty_reference()) {
39-
pTwo = pTwo->tail_;
39+
pTwo = pTwo->tail_;
4040
}
4141

4242
while (pOne && pTwo) {
43-
if (pOne->combinator() != pTwo->combinator()) {
44-
return false;
43+
if (pOne->combinator() != pTwo->combinator()) {
44+
return false;
4545
}
4646

4747
if (*(pOne->head()) != *(pTwo->head())) {
48-
return false;
48+
return false;
4949
}
5050

51-
pOne = pOne->tail_;
51+
pOne = pOne->tail_;
5252
pTwo = pTwo->tail_;
5353
}
5454

@@ -68,21 +68,21 @@ namespace Sass {
6868

6969
bool Simple_Selector::operator==(const Simple_Selector& rhs) const
7070
{
71-
// Compare the string representations for equality.
71+
// Compare the string representations for equality.
7272

73-
// Cast away const here. To_String should take a const object, but it doesn't.
74-
Simple_Selector* pLHS = const_cast<Simple_Selector*>(this);
73+
// Cast away const here. To_String should take a const object, but it doesn't.
74+
Simple_Selector* pLHS = const_cast<Simple_Selector*>(this);
7575
Simple_Selector* pRHS = const_cast<Simple_Selector*>(&rhs);
7676

7777
To_String to_string;
7878
return pLHS->perform(&to_string) == pRHS->perform(&to_string);
7979
}
8080

8181
bool Simple_Selector::operator<(const Simple_Selector& rhs) const {
82-
// Use the string representation for ordering.
82+
// Use the string representation for ordering.
8383

84-
// Cast away const here. To_String should take a const object, but it doesn't.
85-
Simple_Selector* pLHS = const_cast<Simple_Selector*>(this);
84+
// Cast away const here. To_String should take a const object, but it doesn't.
85+
Simple_Selector* pLHS = const_cast<Simple_Selector*>(this);
8686
Simple_Selector* pRHS = const_cast<Simple_Selector*>(&rhs);
8787

8888
To_String to_string;
@@ -217,25 +217,25 @@ namespace Sass {
217217
set<string> lpsuedoset, rpsuedoset;
218218
for (size_t i = 0, L = length(); i < L; ++i)
219219
{
220-
if ((*this)[i]->is_pseudo_element()) {
221-
string pseudo((*this)[i]->perform(&to_string));
220+
if ((*this)[i]->is_pseudo_element()) {
221+
string pseudo((*this)[i]->perform(&to_string));
222222
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
223-
lpsuedoset.insert(pseudo);
223+
lpsuedoset.insert(pseudo);
224224
}
225225
}
226226
for (size_t i = 0, L = rhs->length(); i < L; ++i)
227227
{
228-
if ((*rhs)[i]->is_pseudo_element()) {
229-
string pseudo((*rhs)[i]->perform(&to_string));
228+
if ((*rhs)[i]->is_pseudo_element()) {
229+
string pseudo((*rhs)[i]->perform(&to_string));
230230
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
231-
rpsuedoset.insert(pseudo);
231+
rpsuedoset.insert(pseudo);
232232
}
233233
}
234-
if (lpsuedoset != rpsuedoset) {
234+
if (lpsuedoset != rpsuedoset) {
235235
return false;
236236
}
237237

238-
// Check the Simple_Selectors
238+
// Check the Simple_Selectors
239239

240240
set<string> lset, rset;
241241

@@ -244,19 +244,17 @@ namespace Sass {
244244
for (size_t i = 0, L = length(); i < L; ++i)
245245
{
246246
Selector* lhs = (*this)[i];
247+
// very special case for wrapped matches selector
247248
if (Wrapped_Selector* wrapped = dynamic_cast<Wrapped_Selector*>(lhs)) {
248-
if (
249-
wrapped->name() == ":matches(" ||
250-
wrapped->name() == ":-moz-any("
251-
) {
252-
lhs = wrapped->selector();
253-
if (Selector_List* list = dynamic_cast<Selector_List*>(lhs)) {
254-
if (Compound_Selector* comp = dynamic_cast<Compound_Selector*>(rhs)) {
255-
if (list->is_superselector_of(comp)) return true;
249+
if (wrapped->name() == ":matches(" || wrapped->name() == ":-moz-any(") {
250+
if (Selector_List* list = dynamic_cast<Selector_List*>(wrapped->selector())) {
251+
if (Compound_Selector* comp = dynamic_cast<Compound_Selector*>(rhs)) {
252+
if (list->is_superselector_of(comp)) return true;
253+
}
256254
}
257255
}
258-
}
259256
}
257+
// match from here on as strings
260258
lset.insert(lhs->perform(&to_string));
261259
}
262260
for (size_t i = 0, L = rhs->length(); i < L; ++i)
@@ -290,33 +288,33 @@ namespace Sass {
290288
set<string> lpsuedoset, rpsuedoset;
291289
for (size_t i = 0, L = length(); i < L; ++i)
292290
{
293-
if ((*this)[i]->is_pseudo_element()) {
294-
string pseudo((*this)[i]->perform(&to_string));
291+
if ((*this)[i]->is_pseudo_element()) {
292+
string pseudo((*this)[i]->perform(&to_string));
295293
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
296-
lpsuedoset.insert(pseudo);
294+
lpsuedoset.insert(pseudo);
297295
}
298296
}
299297
for (size_t i = 0, L = rhs.length(); i < L; ++i)
300298
{
301-
if (rhs[i]->is_pseudo_element()) {
302-
string pseudo(rhs[i]->perform(&to_string));
299+
if (rhs[i]->is_pseudo_element()) {
300+
string pseudo(rhs[i]->perform(&to_string));
303301
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
304-
rpsuedoset.insert(pseudo);
302+
rpsuedoset.insert(pseudo);
305303
}
306304
}
307-
if (lpsuedoset != rpsuedoset) {
305+
if (lpsuedoset != rpsuedoset) {
308306
return false;
309307
}
310308

311-
// Check the base
309+
// Check the base
312310

313311
const Simple_Selector* const lbase = base();
314312
const Simple_Selector* const rbase = rhs.base();
315313

316314
if ((lbase && !rbase) ||
317-
(!lbase && rbase) ||
315+
(!lbase && rbase) ||
318316
((lbase && rbase) && (*lbase != *rbase))) {
319-
return false;
317+
return false;
320318
}
321319

322320

@@ -482,7 +480,7 @@ namespace Sass {
482480
Complex_Selector* cpy = new (ctx.mem) Complex_Selector(*this);
483481

484482
if (head()) {
485-
cpy->head(head()->clone(ctx));
483+
cpy->head(head()->clone(ctx));
486484
}
487485

488486
if (tail()) {

0 commit comments

Comments
 (0)