Skip to content

Commit

Permalink
Bump LibSass to 3.5.1
Browse files Browse the repository at this point in the history
Fixes #2280
  • Loading branch information
xzyfer committed Mar 13, 2018
1 parent 96d0d0b commit 3709357
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "node-sass",
"version": "4.8.1",
"libsass": "3.5.0",
"libsass": "3.5.1",
"description": "Wrapper around libsass",
"license": "MIT",
"bugs": "https://github.com/sass/node-sass/issues",
Expand Down Expand Up @@ -83,7 +83,7 @@
"object-merge": "^2.5.1",
"read-yaml": "^1.0.0",
"rimraf": "^2.5.2",
"sass-spec": "^3.5.0",
"sass-spec": "^3.5.1",
"unique-temp-dir": "^1.0.0"
}
}
3 changes: 3 additions & 0 deletions src/libsass/docs/implementations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ There are several implementations of `libsass` for a variety of languages. Here
### C
* [sassc](https://github.com/hcatlin/sassc)

### Crystal
* [sass.cr](https://github.com/straight-shoota/sass.cr)

### Elixir
* [sass.ex](https://github.com/scottdavis/sass.ex)

Expand Down
4 changes: 1 addition & 3 deletions src/libsass/src/check_nesting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ namespace Sass {
this->visit_children(i);

if (Block_Ptr b = Cast<Block>(i->alternative())) {
for (auto n : i->alternative()->elements()) {
n->perform(this);
}
for (auto n : b->elements()) n->perform(this);
}

return i;
Expand Down
7 changes: 5 additions & 2 deletions src/libsass/src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,11 @@ namespace Sass {
Expand expand(*this, &global, &backtrace);
Cssize cssize(*this, &backtrace);
CheckNesting check_nesting;
// check nesting
check_nesting(root);
// check nesting in all files
for (auto sheet : sheets) {
auto styles = sheet.second;
check_nesting(styles.root);
}
// expand and eval the tree
root = expand(root);
// check nesting
Expand Down
1 change: 1 addition & 0 deletions src/libsass/src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@ namespace Sass {
v->value(ops[op](lv, rn.value() * f));
}

v->reduce();
v->pstate(pstate);
return v.detach();
}
Expand Down
16 changes: 8 additions & 8 deletions src/libsass/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ namespace Sass {

namespace Functions {

static Number tmpnr(ParserState("[FN]"), 0);

inline void handle_utf8_error (const ParserState& pstate, Backtrace* backtrace)
{
try {
Expand Down Expand Up @@ -159,7 +157,7 @@ namespace Sass {
{
// Minimal error handling -- the expectation is that built-ins will be written correctly!
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val;
Number tmpnr(val);
tmpnr.reduce();
double v = tmpnr.value();
if (!(lo <= v && v <= hi)) {
Expand All @@ -175,7 +173,7 @@ namespace Sass {
{
// Minimal error handling -- the expectation is that built-ins will be written correctly!
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val;
Number tmpnr(val);
tmpnr.reduce();
return tmpnr;
}
Expand All @@ -193,7 +191,7 @@ namespace Sass {
{
// Minimal error handling -- the expectation is that built-ins will be written correctly!
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val;
Number tmpnr(val);
tmpnr.reduce();
/*
if (tmpnr.unit() == "%") {
Expand All @@ -210,15 +208,16 @@ namespace Sass {
{
// Minimal error handling -- the expectation is that built-ins will be written correctly!
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val;
Number tmpnr(val);
tmpnr.reduce();
return tmpnr.value();
}

double color_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtrace* backtrace)
{
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val; tmpnr.reduce();
Number tmpnr(val);
tmpnr.reduce();
if (tmpnr.unit() == "%") {
return std::min(std::max(tmpnr.value() * 255 / 100.0, 0.0), 255.0);
} else {
Expand All @@ -229,7 +228,8 @@ namespace Sass {

inline double alpha_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtrace* backtrace) {
Number_Ptr val = get_arg<Number>(argname, env, sig, pstate, backtrace);
tmpnr = val; tmpnr.reduce();
Number tmpnr(val);
tmpnr.reduce();
if (tmpnr.unit() == "%") {
return std::min(std::max(tmpnr.value(), 0.0), 100.0);
} else {
Expand Down

0 comments on commit 3709357

Please sign in to comment.