From 81107c8b2e8090663f03ea2b6a38024705f84175 Mon Sep 17 00:00:00 2001 From: xzyfer Date: Wed, 27 May 2015 11:51:16 -0700 Subject: [PATCH] Fix output of nested lists for in @debug --- to_string.cpp | 22 ++++++++++++++++++++++ to_string.hpp | 1 + 2 files changed, 23 insertions(+) diff --git a/to_string.cpp b/to_string.cpp index 361c47facc..b29c4b9470 100644 --- a/to_string.cpp +++ b/to_string.cpp @@ -31,4 +31,26 @@ namespace Sass { inline string To_String::operator()(Null* n) { return ""; } + + inline string To_String::operator()(List* list) + { + string str = ""; + string sep(list->separator() == List::SPACE ? " " : ","); + if (list->empty()) return str; + bool items_output = false; + + for (size_t i = 0, L = list->size(); i < L; ++i) { + Expression* list_item = (*list)[i]; + if (list_item->is_invisible()) { + continue; + } + if (items_output) str += sep; + if (items_output && sep != " ") str += " "; + if (list_item->concrete_type() == Expression::LIST) str += "("; + str += list_item->perform(this); + if (list_item->concrete_type() == Expression::LIST) str += ")"; + items_output = true; + } + return str; + } } diff --git a/to_string.hpp b/to_string.hpp index 38c2a118f2..ba022781a7 100644 --- a/to_string.hpp +++ b/to_string.hpp @@ -26,6 +26,7 @@ namespace Sass { string operator()(Null* n); string operator()(String_Constant*); + string operator()(List*); template string fallback(U n) { return fallback_impl(n); }