@@ -1167,7 +1167,7 @@ namespace Sass {
1167
1167
return l->value () < tmp_r.value ();
1168
1168
}
1169
1169
1170
- Value* Eval::op_numbers (Context& ctx, enum Sass_OP op, Number* l, Number* r)
1170
+ Value* Eval::op_numbers (Context& ctx, enum Sass_OP op, Number* l, Number* r, bool compressed, int precision )
1171
1171
{
1172
1172
double lv = l->value ();
1173
1173
double rv = r->value ();
@@ -1217,7 +1217,7 @@ namespace Sass {
1217
1217
return v;
1218
1218
}
1219
1219
1220
- Value* Eval::op_number_color (Context& ctx, enum Sass_OP op, Number* l, Color* r)
1220
+ Value* Eval::op_number_color (Context& ctx, enum Sass_OP op, Number* l, Color* r, bool compressed, int precision )
1221
1221
{
1222
1222
// TODO: currently SASS converts colors to standard form when adding to strings;
1223
1223
// when https://github.com/nex3/sass/issues/363 is added this can be removed to
@@ -1236,14 +1236,11 @@ namespace Sass {
1236
1236
case Sass_OP::SUB:
1237
1237
case Sass_OP::DIV: {
1238
1238
string sep (op == Sass_OP::SUB ? " -" : " /" );
1239
- To_String to_string (&ctx);
1240
- string color (r->sixtuplet () && (ctx.output_style != COMPRESSED) ?
1241
- r->perform (&to_string) :
1242
- Util::normalize_sixtuplet (r->perform (&to_string)));
1239
+ string color (r->to_string (compressed||!r->sixtuplet (), precision));
1243
1240
return new (ctx.mem ) String_Quoted (l->pstate (),
1244
- l->perform (& to_string)
1245
- + sep
1246
- + color);
1241
+ l->to_string (compressed, precision )
1242
+ + sep
1243
+ + color);
1247
1244
} break ;
1248
1245
case Sass_OP::MOD: {
1249
1246
error (" cannot divide a number by a color" , r->pstate ());
@@ -1254,7 +1251,7 @@ namespace Sass {
1254
1251
return l;
1255
1252
}
1256
1253
1257
- Value* Eval::op_color_number (Context& ctx, enum Sass_OP op, Color* l, Number* r)
1254
+ Value* Eval::op_color_number (Context& ctx, enum Sass_OP op, Color* l, Number* r, bool compressed, int precision )
1258
1255
{
1259
1256
double rv = r->value ();
1260
1257
if (op == Sass_OP::DIV && !rv) error (" division by zero" , r->pstate ());
@@ -1265,7 +1262,7 @@ namespace Sass {
1265
1262
l->a ());
1266
1263
}
1267
1264
1268
- Value* Eval::op_colors (Context& ctx, enum Sass_OP op, Color* l, Color* r)
1265
+ Value* Eval::op_colors (Context& ctx, enum Sass_OP op, Color* l, Color* r, bool compressed, int precision )
1269
1266
{
1270
1267
if (l->a () != r->a ()) {
1271
1268
error (" alpha channels must be equal when combining colors" , r->pstate ());
@@ -1281,14 +1278,17 @@ namespace Sass {
1281
1278
l->a ());
1282
1279
}
1283
1280
1284
- Value* Eval::op_strings (Context& ctx, enum Sass_OP op, Value* lhs, Value*rhs)
1281
+ Value* Eval::op_strings (Context& ctx, enum Sass_OP op, Value* lhs, Value*rhs, bool compressed, int precision )
1285
1282
{
1286
1283
To_String to_string (&ctx);
1287
1284
Expression::Concrete_Type ltype = lhs->concrete_type ();
1288
1285
Expression::Concrete_Type rtype = rhs->concrete_type ();
1289
1286
1290
- string lstr (lhs->perform (&to_string));
1291
- string rstr (rhs->perform (&to_string));
1287
+ String_Quoted* lqstr = dynamic_cast <String_Quoted*>(lhs);
1288
+ String_Quoted* rqstr = dynamic_cast <String_Quoted*>(rhs);
1289
+
1290
+ string lstr (lqstr ? lqstr->value () : lhs->to_string (compressed, precision));
1291
+ string rstr (rqstr ? rqstr->value () : rhs->to_string (compressed, precision));
1292
1292
1293
1293
bool l_str_quoted = ((Sass::String*)lhs) && ((Sass::String*)lhs)->sass_fix_1291 ();
1294
1294
bool r_str_quoted = ((Sass::String*)rhs) && ((Sass::String*)rhs)->sass_fix_1291 ();
0 commit comments