Skip to content

Commit 8ea0ad8

Browse files
authored
Merge pull request #2504 from mgreter/3.4-stable
cherry pick commits from master into 3.4 stable
2 parents 348ff6f + 0d5bc45 commit 8ea0ad8

23 files changed

+172
-73
lines changed

GNUmakefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ else
6969
endif
7070

7171
SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
72-
SASS_TESTER += -c $(SASS_LIBSASS_PATH)/tester$(EXEEXT)
72+
SASS_TESTER += -c $(top_srcdir)/tester$(EXEEXT)
7373

7474
test:
7575
$(SASS_TESTER) $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ install-shared: $(DESTDIR)$(PREFIX)/lib/libsass.so \
299299
install-headers
300300

301301
$(SASSC_BIN): $(BUILD)
302-
$(MAKE) -C $(SASS_SASSC_PATH)
302+
$(MAKE) -C $(SASS_SASSC_PATH) build-$(BUILD)-dev
303303

304304
sassc: $(SASSC_BIN)
305305
$(SASSC_BIN) -v

include/sass2scss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#ifndef SASS2SCSS_VERSION
3838
// Hardcode once the file is copied from
3939
// https://github.com/mgreter/sass2scss
40-
#define SASS2SCSS_VERSION "1.1.0"
40+
#define SASS2SCSS_VERSION "1.1.1"
4141
#endif
4242

4343
// add namespace for c++

script/ci-install-deps

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ if [ "x$AUTOTOOLS" == "xyes" ]; then
1515
sudo apt-get -qq install automake
1616
fi
1717

18-
# https://github.com/sass/libsass/pull/2183
19-
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
20-
brew uninstall libtool
21-
brew install libtool
22-
fi
2318
fi
19+
20+
exit 0

src/ast.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,28 +513,28 @@ namespace Sass {
513513
// check for pseudo elements because they are always last
514514
size_t i, L;
515515
bool found = false;
516-
if (typeid(*this) == typeid(Pseudo_Selector) || typeid(*this) == typeid(Wrapped_Selector))
516+
if (typeid(*this) == typeid(Pseudo_Selector) || typeid(*this) == typeid(Wrapped_Selector) || typeid(*this) == typeid(Attribute_Selector))
517517
{
518518
for (i = 0, L = rhs->length(); i < L; ++i)
519519
{
520-
if ((Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i])) && (*rhs)[L-1]->is_pseudo_element())
520+
if ((Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i]) || Cast<Attribute_Selector>((*rhs)[i])) && (*rhs)[L-1]->is_pseudo_element())
521521
{ found = true; break; }
522522
}
523523
}
524524
else
525525
{
526526
for (i = 0, L = rhs->length(); i < L; ++i)
527527
{
528-
if (Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i]))
528+
if (Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i]) || Cast<Attribute_Selector>((*rhs)[i]))
529529
{ found = true; break; }
530530
}
531531
}
532532
if (!found)
533533
{
534534
rhs->append(this);
535-
return rhs;
535+
} else {
536+
rhs->elements().insert(rhs->elements().begin() + i, this);
536537
}
537-
rhs->elements().insert(rhs->elements().begin() + i, this);
538538
return rhs;
539539
}
540540

src/bind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ namespace Sass {
137137
if (List_Obj rest = Cast<List>(a->value())) {
138138
arglist->separator(rest->separator());
139139

140-
for (size_t i = 0, L = rest->size(); i < L; ++i) {
141-
Expression_Obj obj = rest->at(i);
140+
for (size_t i = 0, L = rest->length(); i < L; ++i) {
141+
Expression_Obj obj = rest->value_at_index(i);
142142
arglist->append(SASS_MEMORY_NEW(Argument,
143143
obj->pstate(),
144144
obj,

src/context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ namespace Sass {
664664
if (!subset_map.empty()) {
665665
// create crtp visitor object
666666
Extend extend(subset_map);
667+
extend.setEval(expand.eval);
667668
// extend tree nodes
668669
extend(root);
669670
}

src/environment.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ namespace Sass {
219219
}
220220
return get_local(key);
221221
}
222-
222+
/*
223223
#ifdef DEBUG
224224
template <typename T>
225225
size_t Environment<T>::print(std::string prefix)
@@ -238,7 +238,7 @@ namespace Sass {
238238
return indent ;
239239
}
240240
#endif
241-
241+
*/
242242
// compile implementation for AST_Node
243243
template class Environment<AST_Node_Obj>;
244244

src/eval.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,9 +1763,27 @@ namespace Sass {
17631763
if (is_in_selector_schema) exp.selector_stack.push_back(0);
17641764
Selector_List_Obj resolved = s->resolve_parent_refs(exp.selector_stack, implicit_parent);
17651765
if (is_in_selector_schema) exp.selector_stack.pop_back();
1766+
for (size_t i = 0; i < resolved->length(); i++) {
1767+
Complex_Selector_Ptr is = resolved->at(i)->first();
1768+
while (is) {
1769+
if (is->head()) {
1770+
is->head()->perform(this);
1771+
}
1772+
is = is->tail();
1773+
}
1774+
}
17661775
return resolved.detach();
17671776
}
17681777

1778+
Compound_Selector_Ptr Eval::operator()(Compound_Selector_Ptr s)
1779+
{
1780+
for (size_t i = 0; i < s->length(); i++) {
1781+
Simple_Selector_Ptr ss = s->at(i);
1782+
if (ss) ss->perform(this);
1783+
}
1784+
return s;
1785+
}
1786+
17691787
// XXX: this is never hit via spec tests
17701788
Attribute_Selector_Ptr Eval::operator()(Attribute_Selector_Ptr s)
17711789
{
@@ -1780,8 +1798,10 @@ namespace Sass {
17801798
{
17811799
LOCAL_FLAG(is_in_selector_schema, true);
17821800
// the parser will look for a brace to end the selector
1801+
ctx.c_options.in_selector = true; // do not compress colors
17831802
Expression_Obj sel = s->contents()->perform(this);
17841803
std::string result_str(sel->to_string(ctx.c_options));
1804+
ctx.c_options.in_selector = false; // flag temporary only
17851805
result_str = unquote(Util::rtrim(result_str));
17861806
char* temp_cstr = sass_copy_c_string(result_str.c_str());
17871807
ctx.strings.push_back(temp_cstr); // attach to context
@@ -1821,4 +1841,39 @@ namespace Sass {
18211841
}
18221842
}
18231843

1844+
// hotfix to avoid invalid nested `:not` selectors
1845+
// probably the wrong place, but this should ultimately
1846+
// be fixed by implement superselector correctly for `:not`
1847+
// first use of "find" (ATM only implemented for selectors)
1848+
bool hasNotSelector(AST_Node_Obj obj) {
1849+
if (Wrapped_Selector_Ptr w = Cast<Wrapped_Selector>(obj)) {
1850+
return w->name() == ":not";
1851+
}
1852+
return false;
1853+
}
1854+
1855+
Wrapped_Selector_Ptr Eval::operator()(Wrapped_Selector_Ptr s)
1856+
{
1857+
1858+
if (s->name() == ":not") {
1859+
if (exp.selector_stack.back()) {
1860+
if (s->selector()->find(hasNotSelector)) {
1861+
s->selector()->clear();
1862+
s->name(" ");
1863+
} else if (s->selector()->length() == 1) {
1864+
Complex_Selector_Ptr cs = s->selector()->at(0);
1865+
if (cs->tail()) {
1866+
s->selector()->clear();
1867+
s->name(" ");
1868+
}
1869+
} else if (s->selector()->length() > 1) {
1870+
s->selector()->clear();
1871+
s->name(" ");
1872+
}
1873+
}
1874+
}
1875+
1876+
return s;
1877+
};
1878+
18241879
}

src/eval.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ namespace Sass {
7575
// these will return selectors
7676
Selector_List_Ptr operator()(Selector_List_Ptr);
7777
Selector_List_Ptr operator()(Complex_Selector_Ptr);
78+
Compound_Selector_Ptr operator()(Compound_Selector_Ptr);
7879
Attribute_Selector_Ptr operator()(Attribute_Selector_Ptr);
7980
// they don't have any specific implementatio (yet)
8081
Element_Selector_Ptr operator()(Element_Selector_Ptr s) { return s; };
8182
Pseudo_Selector_Ptr operator()(Pseudo_Selector_Ptr s) { return s; };
82-
Wrapped_Selector_Ptr operator()(Wrapped_Selector_Ptr s) { return s; };
83+
Wrapped_Selector_Ptr operator()(Wrapped_Selector_Ptr s);
8384
Class_Selector_Ptr operator()(Class_Selector_Ptr s) { return s; };
8485
Id_Selector_Ptr operator()(Id_Selector_Ptr s) { return s; };
8586
Placeholder_Selector_Ptr operator()(Placeholder_Selector_Ptr s) { return s; };

0 commit comments

Comments
 (0)