Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Bump LibSass 3.5.2
Browse files Browse the repository at this point in the history
Fixes #2287
  • Loading branch information
xzyfer committed Mar 17, 2018
1 parent 7648fc4 commit 84754d5
Show file tree
Hide file tree
Showing 38 changed files with 1,014 additions and 887 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "node-sass",
"version": "4.8.2",
"libsass": "3.5.1",
"libsass": "3.5.2",
"description": "Wrapper around libsass",
"license": "MIT",
"bugs": "https://github.com/sass/node-sass/issues",
Expand Down
3 changes: 3 additions & 0 deletions src/libsass.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'sources': [
'libsass/src/ast.cpp',
'libsass/src/ast_fwd_decl.cpp',
'libsass/src/backtrace.cpp',
'libsass/src/base64vlq.cpp',
'libsass/src/bind.cpp',
'libsass/src/cencode.c',
Expand All @@ -35,6 +36,8 @@
'libsass/src/listize.cpp',
'libsass/src/memory/SharedPtr.cpp',
'libsass/src/node.cpp',
'libsass/src/operators.cpp',
'libsass/src/operators.hpp',
'libsass/src/output.cpp',
'libsass/src/parser.cpp',
'libsass/src/plugins.cpp',
Expand Down
2 changes: 2 additions & 0 deletions src/libsass/Makefile.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ SOURCES = \
sass_context.cpp \
sass_functions.cpp \
sass2scss.cpp \
backtrace.cpp \
operators.cpp \
to_c.cpp \
to_value.cpp \
source_map.cpp \
Expand Down
39 changes: 21 additions & 18 deletions src/libsass/src/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ namespace Sass {
return lhs_list->is_superselector_of(rhs_list);
}
}
error("is_superselector expected a Selector_List", sub->pstate());
coreError("is_superselector expected a Selector_List", sub->pstate());
return false;
}

Expand Down Expand Up @@ -1171,7 +1171,7 @@ namespace Sass {
// check if we need to append some headers
// then we need to check for the combinator
// only then we can safely set the new tail
void Complex_Selector::append(Complex_Selector_Obj ss)
void Complex_Selector::append(Complex_Selector_Obj ss, Backtraces& traces)
{

Complex_Selector_Obj t = ss->tail();
Expand All @@ -1185,7 +1185,8 @@ namespace Sass {
// append old headers
if (h && h->length()) {
if (last()->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) {
error("Invalid parent selector", pstate_);
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(this, traces, ss);
} else if (last()->head_ && last()->head_->length()) {
Compound_Selector_Obj rh = last()->head();
size_t i;
Expand Down Expand Up @@ -1258,21 +1259,21 @@ namespace Sass {
return list;
}

Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
if (!this->has_parent_ref()) return this;
Selector_List_Ptr ss = SASS_MEMORY_NEW(Selector_List, pstate());
Selector_List_Ptr ps = pstack.back();
for (size_t pi = 0, pL = ps->length(); pi < pL; ++pi) {
for (size_t si = 0, sL = this->length(); si < sL; ++si) {
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, implicit_parent);
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, traces, implicit_parent);
ss->concat(rv);
}
}
return ss;
}

Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
Complex_Selector_Obj tail = this->tail();
Compound_Selector_Obj head = this->head();
Expand All @@ -1285,7 +1286,7 @@ namespace Sass {
}

// first resolve_parent_refs the tail (which may return an expanded list)
Selector_List_Obj tails = tail ? tail->resolve_parent_refs(pstack, implicit_parent) : 0;
Selector_List_Obj tails = tail ? tail->resolve_parent_refs(pstack, traces, implicit_parent) : 0;

if (head && head->length() > 0) {

Expand Down Expand Up @@ -1331,7 +1332,7 @@ namespace Sass {
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss);
s->append(ss, traces);
retval->append(s);
}
}
Expand All @@ -1346,7 +1347,8 @@ namespace Sass {
// this is only if valid if the parent has no trailing op
// otherwise we cannot append more simple selectors to head
if (parent->last()->combinator() != ANCESTOR_OF) {
throw Exception::InvalidParent(parent, ss);
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(parent, traces, ss);
}
ss->tail(tail ? SASS_MEMORY_CLONE(tail) : NULL);
Compound_Selector_Obj h = SASS_MEMORY_COPY(head_);
Expand All @@ -1369,7 +1371,7 @@ namespace Sass {
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss);
s->append(ss, traces);
retval->append(s);
}
}
Expand Down Expand Up @@ -1406,7 +1408,7 @@ namespace Sass {
for (Simple_Selector_Obj ss : head->elements()) {
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
if (Selector_List_Ptr sl = Cast<Selector_List>(ws->selector())) {
if (parents) ws->selector(sl->resolve_parent_refs(pstack, implicit_parent));
if (parents) ws->selector(sl->resolve_parent_refs(pstack, traces, implicit_parent));
}
}
}
Expand Down Expand Up @@ -1690,7 +1692,7 @@ namespace Sass {
}

if (!pIter->head() || pIter->tail()) {
error("nested selectors may not be extended", c->pstate());
coreError("nested selectors may not be extended", c->pstate());
}

compound_sel->is_optional(extendee->is_optional());
Expand Down Expand Up @@ -1766,31 +1768,31 @@ namespace Sass {
{
if (!a->name().empty()) {
if (has_keyword_argument()) {
error("named arguments must precede variable-length argument", a->pstate());
coreError("named arguments must precede variable-length argument", a->pstate());
}
has_named_arguments(true);
}
else if (a->is_rest_argument()) {
if (has_rest_argument()) {
error("functions and mixins may only be called with one variable-length argument", a->pstate());
coreError("functions and mixins may only be called with one variable-length argument", a->pstate());
}
if (has_keyword_argument_) {
error("only keyword arguments may follow variable arguments", a->pstate());
coreError("only keyword arguments may follow variable arguments", a->pstate());
}
has_rest_argument(true);
}
else if (a->is_keyword_argument()) {
if (has_keyword_argument()) {
error("functions and mixins may only be called with one keyword argument", a->pstate());
coreError("functions and mixins may only be called with one keyword argument", a->pstate());
}
has_keyword_argument(true);
}
else {
if (has_rest_argument()) {
error("ordinal arguments must precede variable-length arguments", a->pstate());
coreError("ordinal arguments must precede variable-length arguments", a->pstate());
}
if (has_named_arguments()) {
error("ordinal arguments must precede named arguments", a->pstate());
coreError("ordinal arguments must precede named arguments", a->pstate());
}
}
}
Expand Down Expand Up @@ -1907,6 +1909,7 @@ namespace Sass {
l.normalize(); r.normalize();
Units &lhs_unit = l, &rhs_unit = r;
if (!(lhs_unit == rhs_unit)) {
/* ToDo: do we always get usefull backtraces? */
throw Exception::IncompatibleUnits(rhs, *this);
}
return lhs_unit < rhs_unit ||
Expand Down
Loading

0 comments on commit 84754d5

Please sign in to comment.