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

Commit 84754d5

Browse files
committed
Bump LibSass 3.5.2
Fixes #2287
1 parent 7648fc4 commit 84754d5

38 files changed

Lines changed: 1014 additions & 887 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "node-sass",
33
"version": "4.8.2",
4-
"libsass": "3.5.1",
4+
"libsass": "3.5.2",
55
"description": "Wrapper around libsass",
66
"license": "MIT",
77
"bugs": "https://github.com/sass/node-sass/issues",

src/libsass.gyp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'sources': [
1414
'libsass/src/ast.cpp',
1515
'libsass/src/ast_fwd_decl.cpp',
16+
'libsass/src/backtrace.cpp',
1617
'libsass/src/base64vlq.cpp',
1718
'libsass/src/bind.cpp',
1819
'libsass/src/cencode.c',
@@ -35,6 +36,8 @@
3536
'libsass/src/listize.cpp',
3637
'libsass/src/memory/SharedPtr.cpp',
3738
'libsass/src/node.cpp',
39+
'libsass/src/operators.cpp',
40+
'libsass/src/operators.hpp',
3841
'libsass/src/output.cpp',
3942
'libsass/src/parser.cpp',
4043
'libsass/src/plugins.cpp',

src/libsass/Makefile.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ SOURCES = \
4141
sass_context.cpp \
4242
sass_functions.cpp \
4343
sass2scss.cpp \
44+
backtrace.cpp \
45+
operators.cpp \
4446
to_c.cpp \
4547
to_value.cpp \
4648
source_map.cpp \

src/libsass/src/ast.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ namespace Sass {
837837
return lhs_list->is_superselector_of(rhs_list);
838838
}
839839
}
840-
error("is_superselector expected a Selector_List", sub->pstate());
840+
coreError("is_superselector expected a Selector_List", sub->pstate());
841841
return false;
842842
}
843843

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

11771177
Complex_Selector_Obj t = ss->tail();
@@ -1185,7 +1185,8 @@ namespace Sass {
11851185
// append old headers
11861186
if (h && h->length()) {
11871187
if (last()->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) {
1188-
error("Invalid parent selector", pstate_);
1188+
traces.push_back(Backtrace(pstate()));
1189+
throw Exception::InvalidParent(this, traces, ss);
11891190
} else if (last()->head_ && last()->head_->length()) {
11901191
Compound_Selector_Obj rh = last()->head();
11911192
size_t i;
@@ -1258,21 +1259,21 @@ namespace Sass {
12581259
return list;
12591260
}
12601261

1261-
Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
1262+
Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
12621263
{
12631264
if (!this->has_parent_ref()) return this;
12641265
Selector_List_Ptr ss = SASS_MEMORY_NEW(Selector_List, pstate());
12651266
Selector_List_Ptr ps = pstack.back();
12661267
for (size_t pi = 0, pL = ps->length(); pi < pL; ++pi) {
12671268
for (size_t si = 0, sL = this->length(); si < sL; ++si) {
1268-
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, implicit_parent);
1269+
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, traces, implicit_parent);
12691270
ss->concat(rv);
12701271
}
12711272
}
12721273
return ss;
12731274
}
12741275

1275-
Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, bool implicit_parent)
1276+
Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
12761277
{
12771278
Complex_Selector_Obj tail = this->tail();
12781279
Compound_Selector_Obj head = this->head();
@@ -1285,7 +1286,7 @@ namespace Sass {
12851286
}
12861287

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

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

@@ -1331,7 +1332,7 @@ namespace Sass {
13311332
// keep old parser state
13321333
s->pstate(pstate());
13331334
// append new tail
1334-
s->append(ss);
1335+
s->append(ss, traces);
13351336
retval->append(s);
13361337
}
13371338
}
@@ -1346,7 +1347,8 @@ namespace Sass {
13461347
// this is only if valid if the parent has no trailing op
13471348
// otherwise we cannot append more simple selectors to head
13481349
if (parent->last()->combinator() != ANCESTOR_OF) {
1349-
throw Exception::InvalidParent(parent, ss);
1350+
traces.push_back(Backtrace(pstate()));
1351+
throw Exception::InvalidParent(parent, traces, ss);
13501352
}
13511353
ss->tail(tail ? SASS_MEMORY_CLONE(tail) : NULL);
13521354
Compound_Selector_Obj h = SASS_MEMORY_COPY(head_);
@@ -1369,7 +1371,7 @@ namespace Sass {
13691371
// keep old parser state
13701372
s->pstate(pstate());
13711373
// append new tail
1372-
s->append(ss);
1374+
s->append(ss, traces);
13731375
retval->append(s);
13741376
}
13751377
}
@@ -1406,7 +1408,7 @@ namespace Sass {
14061408
for (Simple_Selector_Obj ss : head->elements()) {
14071409
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
14081410
if (Selector_List_Ptr sl = Cast<Selector_List>(ws->selector())) {
1409-
if (parents) ws->selector(sl->resolve_parent_refs(pstack, implicit_parent));
1411+
if (parents) ws->selector(sl->resolve_parent_refs(pstack, traces, implicit_parent));
14101412
}
14111413
}
14121414
}
@@ -1690,7 +1692,7 @@ namespace Sass {
16901692
}
16911693

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

16961698
compound_sel->is_optional(extendee->is_optional());
@@ -1766,31 +1768,31 @@ namespace Sass {
17661768
{
17671769
if (!a->name().empty()) {
17681770
if (has_keyword_argument()) {
1769-
error("named arguments must precede variable-length argument", a->pstate());
1771+
coreError("named arguments must precede variable-length argument", a->pstate());
17701772
}
17711773
has_named_arguments(true);
17721774
}
17731775
else if (a->is_rest_argument()) {
17741776
if (has_rest_argument()) {
1775-
error("functions and mixins may only be called with one variable-length argument", a->pstate());
1777+
coreError("functions and mixins may only be called with one variable-length argument", a->pstate());
17761778
}
17771779
if (has_keyword_argument_) {
1778-
error("only keyword arguments may follow variable arguments", a->pstate());
1780+
coreError("only keyword arguments may follow variable arguments", a->pstate());
17791781
}
17801782
has_rest_argument(true);
17811783
}
17821784
else if (a->is_keyword_argument()) {
17831785
if (has_keyword_argument()) {
1784-
error("functions and mixins may only be called with one keyword argument", a->pstate());
1786+
coreError("functions and mixins may only be called with one keyword argument", a->pstate());
17851787
}
17861788
has_keyword_argument(true);
17871789
}
17881790
else {
17891791
if (has_rest_argument()) {
1790-
error("ordinal arguments must precede variable-length arguments", a->pstate());
1792+
coreError("ordinal arguments must precede variable-length arguments", a->pstate());
17911793
}
17921794
if (has_named_arguments()) {
1793-
error("ordinal arguments must precede named arguments", a->pstate());
1795+
coreError("ordinal arguments must precede named arguments", a->pstate());
17941796
}
17951797
}
17961798
}
@@ -1907,6 +1909,7 @@ namespace Sass {
19071909
l.normalize(); r.normalize();
19081910
Units &lhs_unit = l, &rhs_unit = r;
19091911
if (!(lhs_unit == rhs_unit)) {
1912+
/* ToDo: do we always get usefull backtraces? */
19101913
throw Exception::IncompatibleUnits(rhs, *this);
19111914
}
19121915
return lhs_unit < rhs_unit ||

0 commit comments

Comments
 (0)