Skip to content

Commit

Permalink
Fix append function when handling argument lists
Browse files Browse the repository at this point in the history
Fixes sass#1171
  • Loading branch information
mgreter committed May 7, 2015
1 parent 66631c0 commit 47bc665
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 37 deletions.
41 changes: 5 additions & 36 deletions debugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << ind << "Import " << block;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " " << block->tabs() << endl;
debug_ast(block->media_queries(), ind + " @ ");
// debug_ast(block->media_queries(), ind + " @ ");
// vector<string> files_;
for (auto imp : block->urls()) debug_ast(imp, "@ ", env);
} else if (dynamic_cast<Assignment*>(node)) {
Expand Down Expand Up @@ -390,39 +390,26 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
if (env && env->has(name)) debug_ast(static_cast<Expression*>((*env)[name]), ind + " -> ", env);
} else if (dynamic_cast<Function_Call_Schema*>(node)) {
Function_Call_Schema* expression = dynamic_cast<Function_Call_Schema*>(node);
cerr << ind << "Function_Call_Schema " << expression << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Function_Call_Schema " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << "" << endl;
debug_ast(expression->name(), ind + "name: ", env);
debug_ast(expression->arguments(), ind + " args: ", env);
} else if (dynamic_cast<Function_Call*>(node)) {
Function_Call* expression = dynamic_cast<Function_Call*>(node);
cerr << ind << "Function_Call " << expression << " [" << expression->name() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Function_Call " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->name() << "]" << endl;
debug_ast(expression->arguments(), ind + " args: ", env);
} else if (dynamic_cast<Arguments*>(node)) {
Arguments* expression = dynamic_cast<Arguments*>(node);
cerr << ind << "Arguments " << expression << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Arguments " << expression;
if (expression->is_delayed()) cerr << " [delayed]";
cerr << " (" << pstate_source_position(node) << ")";
cerr << endl;
for(auto i : expression->elements()) { debug_ast(i, ind + " ", env); }
} else if (dynamic_cast<Argument*>(node)) {
Argument* expression = dynamic_cast<Argument*>(node);
cerr << ind << "Argument " << expression << " [" << expression->value() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
if (expression->is_rest_argument()) cerr << " [is_rest_argument]";
if (expression->is_keyword_argument()) cerr << " [is_keyword_argument]";
cerr << endl;
cerr << ind << "Argument " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->value() << "]";
Expand All @@ -447,18 +434,12 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << " [rest: " << expression->is_rest_parameter() << "] " << endl;
} else if (dynamic_cast<Unary_Expression*>(node)) {
Unary_Expression* expression = dynamic_cast<Unary_Expression*>(node);
cerr << ind << "Unary_Expression " << expression << " [" << expression->type_name() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Unary_Expression " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->type() << "]" << endl;
debug_ast(expression->operand(), ind + " operand: ", env);
} else if (dynamic_cast<Binary_Expression*>(node)) {
Binary_Expression* expression = dynamic_cast<Binary_Expression*>(node);
cerr << ind << "Binary_Expression " << expression << " [" << expression->type_name() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Binary_Expression " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->type() << "]" << endl;
Expand All @@ -476,9 +457,6 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << " (" << expression->length() << ") " <<
(expression->separator() == Sass::List::Separator::COMMA ? "Comma " : "Space ") <<
" [delayed: " << expression->is_delayed() << "] " <<
" [interpolant: " << expression->is_interpolant() << "]";
if (expression->is_arglist()) cerr << " [is_arglist]";
cerr << endl;
" [interpolant: " << expression->is_interpolant() << "] " <<
" [arglist: " << expression->is_arglist() << "] " <<
endl;
Expand All @@ -490,25 +468,16 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << " [Statement]" << endl;
} else if (dynamic_cast<Boolean*>(node)) {
Boolean* expression = dynamic_cast<Boolean*>(node);
cerr << ind << "Boolean " << expression << " [" << expression->value() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Boolean " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->value() << "]" << endl;
} else if (dynamic_cast<Color*>(node)) {
Color* expression = dynamic_cast<Color*>(node);
cerr << ind << "Color " << expression << " [" << expression->r() << ":" << expression->g() << ":" << expression->b() << "@" << expression->a() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Color " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->r() << ":" << expression->g() << ":" << expression->b() << "@" << expression->a() << "]" << endl;
} else if (dynamic_cast<Number*>(node)) {
Number* expression = dynamic_cast<Number*>(node);
cerr << ind << "Number " << expression << " [" << expression->value() << expression->unit() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
cerr << endl;
cerr << ind << "Number " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << expression->value() << expression->unit() << "]" << endl;
Expand All @@ -533,7 +502,7 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << " [" << prettyprint(expression->value()) << "]";
if (expression->is_delayed()) cerr << " [delayed]";
if (expression->sass_fix_1291()) cerr << " [sass_fix_1291]";
cerr " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << ind << "String_Constant : " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " [" << prettyprint(expression->value()) << "]" <<
Expand All @@ -546,7 +515,7 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
cerr << ind << "String_Schema " << expression << " [" << expression->concrete_type() << "]";
if (expression->is_delayed()) cerr << " [delayed]";
if (expression->has_interpolants()) cerr << " [has_interpolants]";
cerr " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << ind << "String_Schema " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << " " << expression->concrete_type() <<
Expand All @@ -557,7 +526,7 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
String* expression = dynamic_cast<String*>(node);
cerr << ind << "String " << expression << expression->concrete_type();
if (expression->sass_fix_1291()) cerr << " [sass_fix_1291]";
cerr " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << " <" << prettyprint(expression->pstate().token.ws_before()) << ">" << endl;
cerr << ind << "String " << expression;
cerr << " (" << pstate_source_position(node) << ")";
cerr << expression->concrete_type() <<
Expand Down
13 changes: 12 additions & 1 deletion functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,18 @@ namespace Sass {
else if (sep_str == "comma") result->separator(List::COMMA);
else if (sep_str != "auto") error("argument `$separator` of `" + string(sig) + "` must be `space`, `comma`, or `auto`", pstate);
*result += l;
*result << v;
bool is_arglist = l->is_arglist();
result->is_arglist(is_arglist);
if (is_arglist) {
*result << new (ctx.mem) Argument(v->pstate(),
v,
"",
false,
false);

} else {
*result << v;
}
return result;
}

Expand Down

0 comments on commit 47bc665

Please sign in to comment.