Skip to content

Commit

Permalink
Adds default CRTP visitor for String_Quoted
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Jul 13, 2015
1 parent 40ab322 commit 583eac1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
3 changes: 0 additions & 3 deletions inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,6 @@ namespace Sass {

void Inspect::operator()(String_Constant* s)
{
if (String_Quoted* quoted = dynamic_cast<String_Quoted*>(s)) {
return Inspect::operator()(quoted);
}
append_token(s->value(), s);
}

Expand Down
2 changes: 2 additions & 0 deletions operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace Sass {
virtual T operator()(Color* x) = 0;
virtual T operator()(Boolean* x) = 0;
virtual T operator()(String_Schema* x) = 0;
virtual T operator()(String_Quoted* x) = 0;
virtual T operator()(String_Constant* x) = 0;
virtual T operator()(Supports_Query* x) = 0;
virtual T operator()(Supports_Condition* x)= 0;
Expand Down Expand Up @@ -129,6 +130,7 @@ namespace Sass {
virtual T operator()(Boolean* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(String_Schema* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(String_Constant* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(String_Quoted* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(Supports_Query* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(Supports_Condition* x) { return static_cast<D*>(this)->fallback(x); }
virtual T operator()(Media_Query* x) { return static_cast<D*>(this)->fallback(x); }
Expand Down
18 changes: 7 additions & 11 deletions output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,14 @@ namespace Sass {

void Output::operator()(String_Constant* s)
{
if (String_Quoted* quoted = dynamic_cast<String_Quoted*>(s)) {
return Output::operator()(quoted);
string value(s->value());
if (s->can_compress_whitespace() && output_style() == COMPRESSED) {
value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
}
if (!in_comment) {
append_token(string_to_output(value), s);
} else {
string value(s->value());
if (s->can_compress_whitespace() && output_style() == COMPRESSED) {
value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
}
if (!in_comment) {
append_token(string_to_output(value), s);
} else {
append_token(value, s);
}
append_token(value, s);
}
}

Expand Down
4 changes: 2 additions & 2 deletions to_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ namespace Sass {
{ return sass_make_color(c->r(), c->g(), c->b(), c->a()); }

Sass_Value* To_C::operator()(String_Constant* s)
{
{
if (s->quote_mark()) {
return sass_make_qstring(s->value().c_str());
} else {
return sass_make_string(s->value().c_str());
return sass_make_string(s->value().c_str());
}
}

Expand Down
5 changes: 5 additions & 0 deletions to_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ namespace Sass {
return s->value();
}

inline string To_String::operator()(String_Quoted* s)
{
return s->value();
}

inline string To_String::operator()(Null* n)
{ return ""; }
}

0 comments on commit 583eac1

Please sign in to comment.