@@ -25,7 +25,7 @@ namespace Sass {
2525 }
2626
2727 // Expansion function for nodes in an expansion context.
28- void expand (Node expr, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, Backtrace& bt, bool function_name)
28+ void expand (Node expr, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, Backtrace& bt, bool function_name, const Node content )
2929 {
3030 switch (expr.type ())
3131 {
@@ -46,14 +46,22 @@ namespace Sass {
4646 case Node::mixin_call: { // mixin invocation
4747 Token name (expr[0 ].token ());
4848 Node args (expr[1 ]);
49+ Node this_content = expr.size () == 3 ? expr[2 ] : Node ();
50+ if (!this_content.is_null ()) expand (this_content, prefix, env, f_env, new_Node, ctx, bt);
4951 if (!env.query (name)) throw_eval_error (bt, " mixin " + name.to_string () + " is undefined" , expr.path (), expr.line ());
5052 Node mixin (env[name]);
5153 Backtrace here (&bt, expr.path (), expr.line (), " , in mixin '" + name.to_string () + " '" );
52- Node expansion (apply_mixin (mixin, args, prefix, env, f_env, new_Node, ctx, here));
54+ Node expansion (apply_mixin (mixin, args, this_content, prefix, env, f_env, new_Node, ctx, here));
5355 expr.pop_all (); // pop the mixin metadata
5456 expr += expansion; // push the expansion
5557 } break ;
5658
59+ case Node::mixin_content: {
60+ cerr << " HEY" << endl;
61+ expr += content;
62+ cerr << " HO" << endl;
63+ } break ;
64+
5765 case Node::propset: {
5866 // TO DO: perform the property expansion here, rather than in the emitter (also requires the parser to allow interpolants in the property names)
5967 expand (expr[1 ], prefix, env, f_env, new_Node, ctx, bt);
@@ -266,7 +274,7 @@ namespace Sass {
266274 Node i_node (new_Node (expr.path (), expr.line (), i));
267275 Node fake_arg (new_Node (Node::arguments, expr.path (), expr.line (), 1 ));
268276 fake_arg << i_node;
269- expr += apply_mixin (fake_mixin, fake_arg, prefix, env, f_env, new_Node, ctx, bt, true );
277+ expr += apply_mixin (fake_mixin, fake_arg, Node (), prefix, env, f_env, new_Node, ctx, bt, true );
270278 }
271279 } break ;
272280
@@ -286,7 +294,7 @@ namespace Sass {
286294 Node fake_arg (new_Node (Node::arguments, expr.path (), expr.line (), 1 ));
287295 list[i].should_eval () = true ;
288296 fake_arg << eval (list[i], prefix, env, f_env, new_Node, ctx, bt);
289- expr += apply_mixin (fake_mixin, fake_arg, prefix, env, f_env, new_Node, ctx, bt, true );
297+ expr += apply_mixin (fake_mixin, fake_arg, Node (), prefix, env, f_env, new_Node, ctx, bt, true );
290298 }
291299 } break ;
292300
@@ -302,7 +310,7 @@ namespace Sass {
302310 expr.pop_back ();
303311 Node ev_pred (eval (pred, prefix, env, f_env, new_Node, ctx, bt));
304312 while (!ev_pred.is_false ()) {
305- expr += apply_mixin (fake_mixin, fake_arg, prefix, env, f_env, new_Node, ctx, bt, true );
313+ expr += apply_mixin (fake_mixin, fake_arg, Node (), prefix, env, f_env, new_Node, ctx, bt, true );
306314 ev_pred = eval (pred, prefix, env, f_env, new_Node, ctx, bt);
307315 }
308316 } break ;
@@ -831,7 +839,7 @@ namespace Sass {
831839 // Apply a mixin -- bind the arguments in a new environment, link the new
832840 // environment to the current one, then copy the body and eval in the new
833841 // environment.
834- Node apply_mixin (Node mixin, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, Backtrace& bt, bool dynamic_scope)
842+ Node apply_mixin (Node mixin, const Node args, const Node content, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, Backtrace& bt, bool dynamic_scope)
835843 {
836844 Node params (mixin[1 ]);
837845 Node body (new_Node (mixin[2 ])); // clone the body
@@ -852,7 +860,7 @@ namespace Sass {
852860 if (!mixin[0 ].is_null ()) mixin_name << " " << mixin[0 ].to_string ();
853861 bind_arguments (mixin_name.str (), params, evaluated_args, prefix, bindings, f_env, new_Node, ctx, bt);
854862 // evaluate the mixin's body
855- expand (body, prefix, bindings, f_env, new_Node, ctx, bt);
863+ expand (body, prefix, bindings, f_env, new_Node, ctx, bt, false , content );
856864 return body;
857865 }
858866
0 commit comments