From 2f0690067e3fc2c2ee25ea3a40eea2c58789f82b Mon Sep 17 00:00:00 2001 From: xzyfer Date: Fri, 20 Mar 2015 14:55:31 +1100 Subject: [PATCH] Handle only the required nodes in Listize --- context.cpp | 2 +- functions.cpp | 4 ++-- listize.cpp | 18 +++--------------- listize.hpp | 6 +----- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/context.cpp b/context.cpp index d09005f314..cb8df7bd84 100644 --- a/context.cpp +++ b/context.cpp @@ -316,7 +316,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); diff --git a/functions.cpp b/functions.cpp index c2c8d71668..3ded44f243 100644 --- a/functions.cpp +++ b/functions.cpp @@ -1468,7 +1468,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); @@ -1488,7 +1488,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) { diff --git a/listize.cpp b/listize.cpp index 3666485ff2..3e27803904 100644 --- a/listize.cpp +++ b/listize.cpp @@ -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) @@ -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); @@ -90,6 +78,6 @@ namespace Sass { Expression* Listize::fallback_impl(AST_Node* n) { - return 0; + return static_cast(n); } } diff --git a/listize.hpp b/listize.hpp index 916b75ff08..68f060c356 100644 --- a/listize.hpp +++ b/listize.hpp @@ -18,13 +18,11 @@ namespace Sass { class Listize : public Operation_CRTP { Context& ctx; - Env* env; - Backtrace* backtrace; Expression* fallback_impl(AST_Node* n); public: - Listize(Context&, Env*, Backtrace*); + Listize(Context&); virtual ~Listize() { } using Operation::operator(); @@ -32,8 +30,6 @@ namespace Sass { 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