Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit c9cd9ba

Browse files
author
Aaron Leung
committed
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.
1 parent 94d0006 commit c9cd9ba

File tree

4 files changed

+100
-100
lines changed

4 files changed

+100
-100
lines changed

eval_apply.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ namespace Sass {
713713

714714
// Apply a function -- bind the arguments and pass them to the underlying
715715
// primitive function implementation, then return its value.
716-
Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx)
716+
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)
717717
{
718718
if (f.primitive) {
719719
// evaluate arguments in the current environment
@@ -729,7 +729,7 @@ namespace Sass {
729729
Environment bindings;
730730
bindings.link(env.global ? *env.global : env);
731731
bind_arguments("function " + f.name, f.parameters, args, prefix, bindings, f_env, new_Node, ctx);
732-
return f.primitive(f.parameter_names, bindings, new_Node);
732+
return f.primitive(f.parameter_names, bindings, new_Node, path, line);
733733
}
734734
else {
735735
Node params(f.definition[1]);
@@ -778,8 +778,8 @@ namespace Sass {
778778
}
779779
Node var(stm[0]);
780780
if (stm.is_guarded() && bindings.query(var.token())) continue;
781-
// If a binding exists (possible upframe), then update it.
782-
// Otherwise, make a new on in the current frame.
781+
// If a binding exists (possibly upframe), then update it.
782+
// Otherwise, make a new one in the current frame.
783783
if (bindings.query(var.token())) {
784784
bindings[var.token()] = val;
785785
}

eval_apply.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Sass {
1919
double operate(Node::Type op, double lhs, double rhs);
2020

2121
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);
22-
Node apply_function(const Function& f, const Node args, Node prefix, Environment& env, map<string, Function>& f_env, Node_Factory& new_Node, Context& ctx);
22+
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);
2323
Node expand_selector(Node sel, Node pre, Node_Factory& new_Node);
2424
Node expand_backref(Node sel, Node pre);
2525
void extend_selectors(vector<pair<Node, Node> >&, multimap<Node, Node>&, Node_Factory&);

0 commit comments

Comments
 (0)