From 12dbd03be97a306485720b3c430a2d68e1f25e5c Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Mon, 27 Oct 2014 22:05:56 +0100 Subject: [PATCH] Fixes regression with custom precision (#364) --- context.cpp | 3 ++- context.hpp | 2 ++ eval.cpp | 4 +++- inspect.cpp | 3 ++- output_compressed.cpp | 3 ++- output_nested.cpp | 3 ++- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/context.cpp b/context.cpp index 6efd70f160..2d026426a8 100644 --- a/context.cpp +++ b/context.cpp @@ -63,7 +63,8 @@ namespace Sass { names_to_colors (map()), colors_to_names (map()), precision (initializers.precision()), - subset_map (Subset_Map >()) + subset_map (Subset_Map >()), + _skip_source_map_update (initializers._skip_source_map_update()) { cwd = get_cwd(); diff --git a/context.hpp b/context.hpp index 5f530655b2..337b6bfebb 100644 --- a/context.hpp +++ b/context.hpp @@ -60,6 +60,7 @@ namespace Sass { map colors_to_names; size_t precision; // precision for outputting fractional numbers + bool _skip_source_map_update; // status flag to skip source map updates KWD_ARG_SET(Data) { KWD_ARG(Data, const char*, source_c_str); @@ -75,6 +76,7 @@ namespace Sass { KWD_ARG(Data, bool, omit_source_map_url); KWD_ARG(Data, bool, is_indented_syntax_src); KWD_ARG(Data, size_t, precision); + KWD_ARG(Data, bool, _skip_source_map_update); }; Context(Data); diff --git a/eval.cpp b/eval.cpp index 0e364c65da..4f1bd267dc 100644 --- a/eval.cpp +++ b/eval.cpp @@ -500,7 +500,9 @@ namespace Sass { Expression* Eval::operator()(String_Schema* s) { string acc; - To_String to_string(0); + ctx._skip_source_map_update = true; + To_String to_string(&ctx); + ctx._skip_source_map_update = false; for (size_t i = 0, L = s->length(); i < L; ++i) { string chunk((*s)[i]->perform(this)->perform(&to_string)); if (((s->quote_mark() && is_quoted(chunk)) || !s->quote_mark()) && (*s)[i]->is_interpolant()) { // some redundancy in that test diff --git a/inspect.cpp b/inspect.cpp index 18f12d7f6c..dd0b3ebfa3 100644 --- a/inspect.cpp +++ b/inspect.cpp @@ -627,7 +627,8 @@ namespace Sass { void Inspect::append_to_buffer(const string& text) { buffer += text; - if (ctx) ctx->source_map.update_column(text); + if (ctx && !ctx->_skip_source_map_update) + ctx->source_map.update_column(text); } } diff --git a/output_compressed.cpp b/output_compressed.cpp index 055de7533a..df6b0c3fad 100644 --- a/output_compressed.cpp +++ b/output_compressed.cpp @@ -363,7 +363,8 @@ namespace Sass { void Output_Compressed::append_singleline_part_to_buffer(const string& text) { buffer += text; - if (ctx) ctx->source_map.update_column(text); + if (ctx && !ctx->_skip_source_map_update) + ctx->source_map.update_column(text); } } diff --git a/output_nested.cpp b/output_nested.cpp index 6ead1bf20c..7ca38dc5ea 100644 --- a/output_nested.cpp +++ b/output_nested.cpp @@ -262,7 +262,8 @@ namespace Sass { void Output_Nested::append_to_buffer(const string& text) { buffer += text; - if (ctx) ctx->source_map.update_column(text); + if (ctx && !ctx->_skip_source_map_update) + ctx->source_map.update_column(text); } }