From 37093575ee9736a513decb16e581f9fc789d56f7 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Tue, 13 Mar 2018 08:54:40 +1100 Subject: [PATCH] Bump LibSass to 3.5.1 Fixes #2280 --- package.json | 4 ++-- src/libsass/docs/implementations.md | 3 +++ src/libsass/src/check_nesting.cpp | 4 +--- src/libsass/src/context.cpp | 7 +++++-- src/libsass/src/eval.cpp | 1 + src/libsass/src/functions.cpp | 16 ++++++++-------- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 6dedfc427..f28eb7cf8 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/src/libsass/docs/implementations.md b/src/libsass/docs/implementations.md index 4321558c3..4814cdd8e 100644 --- a/src/libsass/docs/implementations.md +++ b/src/libsass/docs/implementations.md @@ -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) diff --git a/src/libsass/src/check_nesting.cpp b/src/libsass/src/check_nesting.cpp index 952bb3380..19b43e0d8 100644 --- a/src/libsass/src/check_nesting.cpp +++ b/src/libsass/src/check_nesting.cpp @@ -108,9 +108,7 @@ namespace Sass { this->visit_children(i); if (Block_Ptr b = Cast(i->alternative())) { - for (auto n : i->alternative()->elements()) { - n->perform(this); - } + for (auto n : b->elements()) n->perform(this); } return i; diff --git a/src/libsass/src/context.cpp b/src/libsass/src/context.cpp index 2c51db223..b64369f63 100644 --- a/src/libsass/src/context.cpp +++ b/src/libsass/src/context.cpp @@ -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 diff --git a/src/libsass/src/eval.cpp b/src/libsass/src/eval.cpp index 9ea80c05d..67fa628a3 100644 --- a/src/libsass/src/eval.cpp +++ b/src/libsass/src/eval.cpp @@ -1562,6 +1562,7 @@ namespace Sass { v->value(ops[op](lv, rn.value() * f)); } + v->reduce(); v->pstate(pstate); return v.detach(); } diff --git a/src/libsass/src/functions.cpp b/src/libsass/src/functions.cpp index 8461c9096..aaa3394fb 100644 --- a/src/libsass/src/functions.cpp +++ b/src/libsass/src/functions.cpp @@ -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 { @@ -159,7 +157,7 @@ namespace Sass { { // Minimal error handling -- the expectation is that built-ins will be written correctly! Number_Ptr val = get_arg(argname, env, sig, pstate, backtrace); - tmpnr = val; + Number tmpnr(val); tmpnr.reduce(); double v = tmpnr.value(); if (!(lo <= v && v <= hi)) { @@ -175,7 +173,7 @@ namespace Sass { { // Minimal error handling -- the expectation is that built-ins will be written correctly! Number_Ptr val = get_arg(argname, env, sig, pstate, backtrace); - tmpnr = val; + Number tmpnr(val); tmpnr.reduce(); return tmpnr; } @@ -193,7 +191,7 @@ namespace Sass { { // Minimal error handling -- the expectation is that built-ins will be written correctly! Number_Ptr val = get_arg(argname, env, sig, pstate, backtrace); - tmpnr = val; + Number tmpnr(val); tmpnr.reduce(); /* if (tmpnr.unit() == "%") { @@ -210,7 +208,7 @@ namespace Sass { { // Minimal error handling -- the expectation is that built-ins will be written correctly! Number_Ptr val = get_arg(argname, env, sig, pstate, backtrace); - tmpnr = val; + Number tmpnr(val); tmpnr.reduce(); return tmpnr.value(); } @@ -218,7 +216,8 @@ namespace Sass { double color_num(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtrace* backtrace) { Number_Ptr val = get_arg(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 { @@ -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(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 {