Skip to content

Commit

Permalink
Merge pull request #975 from xzyfer/clean/ampersand-in-sassscript
Browse files Browse the repository at this point in the history
Handle only the required nodes in Listize
  • Loading branch information
mgreter committed Mar 30, 2015
2 parents efeace5 + 2f06900 commit 4c2a62a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace Sass {
register_c_function(*this, &tge, c_functions[i]);
}
Contextualize contextualize(*this, &tge, &backtrace);
Listize listize(*this, &tge, &backtrace);
Listize listize(*this);
Eval eval(*this, &contextualize, &listize, &tge, &backtrace);
Contextualize_Eval contextualize_eval(*this, &eval, &tge, &backtrace);
Expand expand(*this, &eval, &contextualize_eval, &tge, &backtrace);
Expand Down
4 changes: 2 additions & 2 deletions functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ namespace Sass {
}
Function_Call* func = new (ctx.mem) Function_Call(pstate, name, args);
Contextualize contextualize(ctx, &d_env, backtrace);
Listize listize(ctx, &d_env, backtrace);
Listize listize(ctx);
Eval eval(ctx, &contextualize, &listize, &d_env, backtrace);
return func->perform(&eval);

Expand All @@ -1492,7 +1492,7 @@ namespace Sass {
BUILT_IN(sass_if)
{
Contextualize contextualize(ctx, &d_env, backtrace);
Listize listize(ctx, &d_env, backtrace);
Listize listize(ctx);
Eval eval(ctx, &contextualize, &listize, &d_env, backtrace);
bool is_true = !ARG("$condition", Expression)->perform(&eval)->is_false();
if (is_true) {
Expand Down
18 changes: 3 additions & 15 deletions listize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

namespace Sass {

Listize::Listize(Context& ctx, Env* env, Backtrace* bt)
: ctx(ctx),
env(env),
backtrace(bt)
Listize::Listize(Context& ctx)
: ctx(ctx)
{ }

Expression* Listize::operator()(Selector_List* sel)
Expand All @@ -35,16 +33,6 @@ namespace Sass {
return new (ctx.mem) String_Constant(sel->pstate(), str);
}

Expression* Listize::operator()(Type_Selector* sel)
{
return new (ctx.mem) String_Constant(sel->pstate(), sel->name());
}

Expression* Listize::operator()(Selector_Qualifier* sel)
{
return new (ctx.mem) String_Constant(sel->pstate(), sel->name());
}

Expression* Listize::operator()(Complex_Selector* sel)
{
List* l = new (ctx.mem) List(sel->pstate(), 2);
Expand Down Expand Up @@ -90,6 +78,6 @@ namespace Sass {

Expression* Listize::fallback_impl(AST_Node* n)
{
return 0;
return static_cast<Expression*>(n);
}
}
6 changes: 1 addition & 5 deletions listize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,18 @@ namespace Sass {
class Listize : public Operation_CRTP<Expression*, Listize> {

Context& ctx;
Env* env;
Backtrace* backtrace;

Expression* fallback_impl(AST_Node* n);

public:
Listize(Context&, Env*, Backtrace*);
Listize(Context&);
virtual ~Listize() { }

using Operation<Expression*>::operator();

Expression* operator()(Selector_List*);
Expression* operator()(Complex_Selector*);
Expression* operator()(Compound_Selector*);
Expression* operator()(Type_Selector*);
Expression* operator()(Selector_Qualifier*);
Expression* operator()(Selector_Reference*);

template <typename U>
Expand Down

0 comments on commit 4c2a62a

Please sign in to comment.