@@ -127,7 +127,6 @@ namespace Sass {
127127 Node var (expr[0 ]);
128128 if (expr.is_guarded () && env.query (var.token ())) return ;
129129 Node val (expr[1 ]);
130- // val = eval(val, prefix, env, f_env, new_Node, ctx);
131130 if (val.type () == Node::list) {
132131 for (size_t i = 0 , S = val.size (); i < S; ++i) {
133132 if (val[i].should_eval ()) val[i] = eval (val[i], prefix, env, f_env, new_Node, ctx);
@@ -251,7 +250,6 @@ namespace Sass {
251250 } break ;
252251
253252 case Node::warning: {
254- // expr = new_Node(expr);
255253 Node contents (eval (expr[0 ], Node (), env, f_env, new_Node, ctx));
256254
257255 string prefix (" WARNING: " );
@@ -279,26 +277,6 @@ namespace Sass {
279277 Node result = Node ();
280278 switch (expr.type ())
281279 {
282- // case Node::selector_schema: {
283- // string expansion;
284- // for (size_t i = 0, S = expr.size(); i < S; ++i) {
285- // expr[i] = eval(expr[i], prefix, env, f_env, new_Node, ctx);
286- // if (expr[i].type() == Node::string_constant) {
287- // expansion += expr[i].token().unquote();
288- // }
289- // else {
290- // expansion += expr[i].to_string();
291- // }
292- // }
293- // expansion += " {"; // the parser looks for an lbrace to end a selector
294- // char* expn_src = new char[expansion.size() + 1];
295- // strcpy(expn_src, expansion.c_str());
296- // Document needs_reparsing(Document::make_from_source_chars(ctx, expn_src, expr.path(), true));
297- // needs_reparsing.line = expr.line(); // set the line number to the original node's line
298- // Node sel(needs_reparsing.parse_selector_group());
299- // return sel;
300- // } break;
301-
302280 case Node::list: {
303281 if (expr.should_eval () && expr.size () > 0 ) {
304282 result = new_Node (Node::list, expr.path (), expr.line (), expr.size ());
@@ -323,7 +301,6 @@ namespace Sass {
323301 } break ;
324302
325303 case Node::relation: {
326-
327304 Node lhs (eval (expr[0 ], prefix, env, f_env, new_Node, ctx));
328305 Node op (expr[1 ]);
329306 Node rhs (eval (expr[2 ], prefix, env, f_env, new_Node, ctx));
@@ -755,10 +732,6 @@ namespace Sass {
755732 bind_arguments (mixin_name.str (), params, evaluated_args, prefix, bindings, f_env, new_Node, ctx);
756733 // evaluate the mixin's body
757734 expand (body, prefix, bindings, f_env, new_Node, ctx);
758- // for (size_t i = 0, S = body.size(); i < S; ++i) {
759- // expand(body[i], prefix, bindings, f_env, new_Node, ctx);
760- // }
761- // cerr << "expanded " << mixin_name.str() << endl;
762735 return body;
763736 }
764737
@@ -778,15 +751,15 @@ namespace Sass {
778751 }
779752 else {
780753 // TO DO: consider cloning the function body?
781- return function_eval (f.name , f.definition [2 ], bindings, new_Node, ctx, true );
754+ return eval_function (f.name , f.definition [2 ], bindings, new_Node, ctx, true );
782755 }
783756 }
784757
785758 // Special function for evaluating pure Sass functions. The evaluation
786759 // algorithm is different in this case because the body needs to be
787760 // executed and a single value needs to be returned directly, rather than
788761 // styles being expanded and spliced in place.
789- Node function_eval (string name, Node body, Environment& bindings, Node_Factory& new_Node, Context& ctx, bool at_toplevel)
762+ Node eval_function (string name, Node body, Environment& bindings, Node_Factory& new_Node, Context& ctx, bool at_toplevel)
790763 {
791764 for (size_t i = 0 , S = body.size (); i < S; ++i) {
792765 Node stm (body[i]);
@@ -820,13 +793,13 @@ namespace Sass {
820793 Node pred (new_Node (stm[j]));
821794 Node predicate_val (eval (pred, Node (), bindings, ctx.function_env , new_Node, ctx));
822795 if ((predicate_val.type () != Node::boolean) || predicate_val.boolean_value ()) {
823- Node v (function_eval (name, stm[j+1 ], bindings, new_Node, ctx));
796+ Node v (eval_function (name, stm[j+1 ], bindings, new_Node, ctx));
824797 if (v.is_null ()) break ;
825798 else return v;
826799 }
827800 }
828801 else {
829- Node v (function_eval (name, stm[j], bindings, new_Node, ctx));
802+ Node v (eval_function (name, stm[j], bindings, new_Node, ctx));
830803 if (v.is_null ()) break ;
831804 else return v;
832805 }
@@ -846,7 +819,7 @@ namespace Sass {
846819 j < T;
847820 j += 1 ) {
848821 for_env.current_frame [iter_var.token ()] = new_Node (lower_bound.path (), lower_bound.line (), j);
849- Node v (function_eval (name, for_body, for_env, new_Node, ctx));
822+ Node v (eval_function (name, for_body, for_env, new_Node, ctx));
850823 if (v.is_null ()) continue ;
851824 else return v;
852825 }
@@ -863,7 +836,7 @@ namespace Sass {
863836 each_env.link (bindings);
864837 for (size_t j = 0 , T = list.size (); j < T; ++j) {
865838 each_env.current_frame [iter_var.token ()] = eval (list[j], Node (), bindings, ctx.function_env , new_Node, ctx);
866- Node v (function_eval (name, each_body, each_env, new_Node, ctx));
839+ Node v (eval_function (name, each_body, each_env, new_Node, ctx));
867840 if (v.is_null ()) continue ;
868841 else return v;
869842 }
@@ -876,7 +849,7 @@ namespace Sass {
876849 while_env.link (bindings);
877850 Node pred_val (eval (pred_expr, Node (), bindings, ctx.function_env , new_Node, ctx));
878851 while ((pred_val.type () != Node::boolean) || pred_val.boolean_value ()) {
879- Node v (function_eval (name, while_body, while_env, new_Node, ctx));
852+ Node v (eval_function (name, while_body, while_env, new_Node, ctx));
880853 if (v.is_null ()) {
881854 pred_val = eval (new_Node (stm[0 ]), Node (), bindings, ctx.function_env , new_Node, ctx);
882855 continue ;
0 commit comments