Commit c9cd9ba8 by Aaron Leung

Passing the path and line-number into the built-in functions in order to…

Passing the path and line-number into the built-in functions in order to generate the most accurate file-names and line numbers for intermediate return values.
parent 94d00064
...@@ -713,7 +713,7 @@ namespace Sass { ...@@ -713,7 +713,7 @@ namespace Sass {
// Apply a function -- bind the arguments and pass them to the underlying // Apply a function -- bind the arguments and pass them to the underlying
// primitive function implementation, then return its value. // primitive function implementation, then return its value.
Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx) Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, string path, size_t line)
{ {
if (f.primitive) { if (f.primitive) {
// evaluate arguments in the current environment // evaluate arguments in the current environment
...@@ -729,7 +729,7 @@ namespace Sass { ...@@ -729,7 +729,7 @@ namespace Sass {
Environment bindings; Environment bindings;
bindings.link(env.global ? *env.global : env); bindings.link(env.global ? *env.global : env);
bind_arguments("function " + f.name, f.parameters, args, prefix, bindings, f_env, new_Node, ctx); bind_arguments("function " + f.name, f.parameters, args, prefix, bindings, f_env, new_Node, ctx);
return f.primitive(f.parameter_names, bindings, new_Node); return f.primitive(f.parameter_names, bindings, new_Node, path, line);
} }
else { else {
Node params(f.definition[1]); Node params(f.definition[1]);
...@@ -778,8 +778,8 @@ namespace Sass { ...@@ -778,8 +778,8 @@ namespace Sass {
} }
Node var(stm[0]); Node var(stm[0]);
if (stm.is_guarded() && bindings.query(var.token())) continue; if (stm.is_guarded() && bindings.query(var.token())) continue;
// If a binding exists (possible upframe), then update it. // If a binding exists (possibly upframe), then update it.
// Otherwise, make a new on in the current frame. // Otherwise, make a new one in the current frame.
if (bindings.query(var.token())) { if (bindings.query(var.token())) {
bindings[var.token()] = val; bindings[var.token()] = val;
} }
......
...@@ -19,7 +19,7 @@ namespace Sass { ...@@ -19,7 +19,7 @@ namespace Sass {
double operate(Node::Type op, double lhs, double rhs); double operate(Node::Type op, double lhs, double rhs);
Node apply_mixin(Node mixin, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, bool dynamic_scope = false); Node apply_mixin(Node mixin, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, bool dynamic_scope = false);
Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx); Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx, string path = "", size_t line = 0);
Node expand_selector(Node sel, Node pre, Node_Factory& new_Node); Node expand_selector(Node sel, Node pre, Node_Factory& new_Node);
Node expand_backref(Node sel, Node pre); Node expand_backref(Node sel, Node pre);
void extend_selectors(vector<pair<Node, Node> >&, multimap<Node, Node>&, Node_Factory&); void extend_selectors(vector<pair<Node, Node> >&, multimap<Node, Node>&, Node_Factory&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment