From a7c6a1ad5b4e03bb5484bdf214f579f82b1cc733 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 6 Jan 2017 16:51:20 -0800 Subject: [PATCH] Fix String.asInterpolation(). We were checking if its contents was an Interpolation, when we should have been checking for an Expression. --- CHANGELOG.md | 3 +++ lib/src/ast/sass/expression/string.dart | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9d9535..e57a61ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ * Fix a few more small `@extend` bugs. +* Fix a bug where interpolation in a quoted string was being dropped in some + circumstances. + ## 1.0.0-alpha.6 * Allow `var()` to be passed to `rgb()`, `rgba()`, `hsl()`, and `hsla()`. diff --git a/lib/src/ast/sass/expression/string.dart b/lib/src/ast/sass/expression/string.dart index 679eb0b8..3d7ec32a 100644 --- a/lib/src/ast/sass/expression/string.dart +++ b/lib/src/ast/sass/expression/string.dart @@ -55,8 +55,9 @@ class StringExpression implements Expression { var buffer = new InterpolationBuffer(); if (quote != null) buffer.writeCharCode(quote); for (var value in text.contents) { - if (value is Interpolation) { - buffer.addInterpolation(value); + assert(value is Expression || value is String); + if (value is Expression) { + buffer.add(value); } else if (value is String) { for (var i = 0; i < value.length; i++) { var codeUnit = value.codeUnitAt(i);