@@ -722,6 +722,24 @@ namespace Sass {
722
722
break ;
723
723
case Interpolant::ExpressionInterpolant:
724
724
value = static_cast <Expression*>(itpl)->accept (this );
725
+ if (warnForColor) {
726
+ if (Color* color = value->isaColor ()) {
727
+ ColorRgbaObj rgba = color->toRGBA ();
728
+ double numval = rgba->r () * 0x10000
729
+ + rgba->g () * 0x100 + rgba->b ();
730
+ if (const char * disp = color_to_name (numval)) {
731
+ sass::sstream msg;
732
+ msg << " You probably don't mean to use the color value " ;
733
+ msg << disp << " in interpolation here.\n It may end up represented " ;
734
+ msg << " as " << rgba->inspect () <<" , which will likely produce invalid " ;
735
+ msg << " CSS. Always quote color names when using them as strings or map " ;
736
+ msg << " keys (for example, \" " << disp << " \" ). If you really want to " ;
737
+ msg << " use the color value, append it to an empty string first to avoid " ;
738
+ msg << " this warning (for example, '\"\" + " << disp << " ')." ;
739
+ logger456.addWarning (msg.str (), itpl->pstate ());
740
+ }
741
+ }
742
+ }
725
743
value->accept (&cssize);
726
744
break ;
727
745
}
@@ -760,7 +778,7 @@ namespace Sass {
760
778
SelectorListObj Eval::interpolationToSelector (Interpolation* itpl, bool plainCss, bool allowParent)
761
779
{
762
780
// Create a new source data object from the evaluated interpolation
763
- SourceDataObj synthetic = interpolationToSource (itpl, false , true );
781
+ SourceDataObj synthetic = interpolationToSource (itpl, true , true );
764
782
// Everything parsed, will be parsed from perspective of local content
765
783
// Pass the source-map in for the interpolation, so the scanner can
766
784
// update the positions according to previous source-positions
0 commit comments