From a5a8d79629af2fdb67423c34046791e441a1f7af Mon Sep 17 00:00:00 2001 From: Cerdic Date: Tue, 14 May 2019 10:28:49 +0200 Subject: [PATCH 1/3] test case for https://github.com/leafo/scssphp/issues/486 --- tests/inputs/interpolation.scss | 7 +++++++ tests/outputs/interpolation.css | 3 +++ tests/outputs_numbered/interpolation.css | 3 +++ 3 files changed, 13 insertions(+) diff --git a/tests/inputs/interpolation.scss b/tests/inputs/interpolation.scss index 0819a7c6..45a5133b 100644 --- a/tests/inputs/interpolation.scss +++ b/tests/inputs/interpolation.scss @@ -132,4 +132,11 @@ div { .pagination { @include pagination-mixin(5px); +} + +@mixin set-border($width) { + border: $width solid #000; +} +.element { + @include set-border(#{2px}); // compiles to "2px solid #000" } \ No newline at end of file diff --git a/tests/outputs/interpolation.css b/tests/outputs/interpolation.css index be302600..d9fd10e5 100644 --- a/tests/outputs/interpolation.css +++ b/tests/outputs/interpolation.css @@ -74,3 +74,6 @@ a.badge { .pagination .page-item:first-child .page-link { border-radius: 5px; } + +.element { + border: 2px solid #000; } diff --git a/tests/outputs_numbered/interpolation.css b/tests/outputs_numbered/interpolation.css index 768df93a..da509491 100644 --- a/tests/outputs_numbered/interpolation.css +++ b/tests/outputs_numbered/interpolation.css @@ -93,3 +93,6 @@ a.badge { /* line 126, inputs/interpolation.scss */ .pagination .page-item:first-child .page-link { border-radius: 5px; } +/* line 140, inputs/interpolation.scss */ +.element { + border: 2px solid #000; } From a475f369433871dc3003fc899e71131c34fdc712 Mon Sep 17 00:00:00 2001 From: Cerdic Date: Tue, 14 May 2019 10:29:50 +0200 Subject: [PATCH 2/3] Fix https://github.com/leafo/scssphp/issues/486: take in account the inExp flag for reducing T_INTERPOLATE --- src/Compiler.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Compiler.php b/src/Compiler.php index af20970e..fa66312c 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -2630,6 +2630,9 @@ protected function reduce($value, $inExp = false) case Type::T_INTERPOLATE: $value[1] = $this->reduce($value[1]); + if ($inExp) { + return $value[1]; + } return $value; From 2b871b27abb610120d89a0692b11d4db498b13d4 Mon Sep 17 00:00:00 2001 From: Cerdic Date: Tue, 14 May 2019 10:36:28 +0200 Subject: [PATCH 3/3] PSR2 fixes --- src/Compiler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler.php b/src/Compiler.php index fa66312c..02ac275c 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -855,7 +855,6 @@ protected function compileMedia(Block $media) $this->scope->children[] = $annotation; } - } $this->compileChildrenNoReturn($media->children, $this->scope); @@ -3375,7 +3374,7 @@ protected function multiplySelectors(Environment $env, $selfParent = null) $selectors[serialize($s)] = $s; } } else { - $s = $this->joinSelectors($parent, $selector,$stillHasSelf); + $s = $this->joinSelectors($parent, $selector, $stillHasSelf); $selectors[serialize($s)] = $s; } }