Skip to content

Commit

Permalink
sass#548 fixes for eval calling var->perform(this)
Browse files Browse the repository at this point in the history
edits responding to comments for append_string
typo for the broken line comma
added contextualize_eval to the visual studio project file.
  • Loading branch information
Eric Kimn committed Mar 17, 2015
1 parent 324b14f commit 1c15df0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
25 changes: 3 additions & 22 deletions eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,21 +736,15 @@ namespace Sass {
}

string Eval::interpolation(Expression* s) {

if (String_Quoted* str_quoted = dynamic_cast<String_Quoted*>(s)) {

if (str_quoted->quote_mark()) {
return string_escape(str_quoted->value());
} else {
return evacuate_escapes(str_quoted->value());
}

} else if (String_Constant* str_constant = dynamic_cast<String_Constant*>(s)) {

return evacuate_escapes(str_constant->value());

} else if (String_Schema* str_schema = dynamic_cast<String_Schema*>(s)) {

string res = "";
for(auto i : str_schema->elements())
res += (interpolation(i));
Expand All @@ -762,9 +756,7 @@ namespace Sass {
} else {
return evacuate_quotes(unq);
}

} else if (List* list = dynamic_cast<List*>(s)) {

string acc = ""; // ToDo: different output styles
string sep = list->separator() == List::Separator::COMMA ? "," : " ";
if (ctx.output_style != COMPRESSED && sep == ",") sep += " ";
Expand All @@ -775,35 +767,24 @@ namespace Sass {
initial = true;
}
return evacuate_quotes(acc);

} else if (Variable* var = dynamic_cast<Variable*>(s)) {

string name(var->name());
if (!env->has(name)) error("Undefined variable: \"" + var->name() + "\".", var->pstate());
Expression* value = static_cast<Expression*>((*env)[name]);
return evacuate_quotes(interpolation(value));

} else if (Binary_Expression* var = dynamic_cast<Binary_Expression*>(s)) {

Expression* ex = operator()(var);
Expression* ex = var->perform(this);
return evacuate_quotes(interpolation(ex));

} else if (Function_Call* var = dynamic_cast<Function_Call*>(s)) {

Expression* ex = operator()(var);
Expression* ex = var->perform(this);
return evacuate_quotes(interpolation(ex));

} else if (Parent_Selector* var = dynamic_cast<Parent_Selector*>(s)) {

Expression* ex = operator()(var);
Expression* ex = var->perform(this);
return evacuate_quotes(interpolation(ex));

} else {

To_String to_string(&ctx);
// to_string.in_decl_list = true;
return evacuate_quotes(s->perform(&to_string));

}
}

Expand Down
3 changes: 1 addition & 2 deletions inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ namespace Sass {
{
if (p->selector()) {
p->selector()->perform(this);
string str = this->get_buffer();
str += ";";
append_string(";");
}
else {
append_string("&");
Expand Down
3 changes: 1 addition & 2 deletions sass.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ extern "C" {
// Different render styles
enum Sass_Output_Style {
SASS_STYLE_NESTED,
SASS_STYLE_EXPANDED
,
SASS_STYLE_EXPANDED,
SASS_STYLE_COMPACT,
SASS_STYLE_COMPRESSED
};
Expand Down
2 changes: 2 additions & 0 deletions win/libsass.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<ClCompile Include="..\constants.cpp" />
<ClCompile Include="..\context.cpp" />
<ClCompile Include="..\contextualize.cpp" />
<ClCompile Include="..\contextualize_eval.cpp" />
<ClCompile Include="..\error_handling.cpp" />
<ClCompile Include="..\eval.cpp" />
<ClCompile Include="..\expand.cpp" />
Expand Down Expand Up @@ -208,6 +209,7 @@
<ClInclude Include="..\constants.hpp" />
<ClInclude Include="..\context.hpp" />
<ClInclude Include="..\contextualize.hpp" />
<ClInclude Include="..\contextualize_eval.hpp" />
<ClInclude Include="..\debug.hpp" />
<ClInclude Include="..\environment.hpp" />
<ClInclude Include="..\error_handling.hpp" />
Expand Down

0 comments on commit 1c15df0

Please sign in to comment.