5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/xass.rb', line 5
def visit_mixin(node)
@environment.stack.with_mixin(node.filename, node.line, node.name) do
mixin = @environment.mixin(node.name)
raise Sass::SyntaxError.new("Undefined mixin '#{node.name}'.") unless mixin
if node.children.any? && !mixin.has_content
raise Sass::SyntaxError.new(%Q{Mixin "#{node.name}" does not accept a content block.})
end
args = node.args.map {|a| a.perform(@environment)}
keywords = Sass::Util.map_vals(node.keywords) {|v| v.perform(@environment)}
splat = self.class.perform_splat(node.splat, keywords, node.kwarg_splat, @environment)
self.class.perform_arguments(mixin, args, splat, @environment) do |env|
env.caller = Sass::Environment.new(@environment)
env.content = [node.children, @environment] if node.has_children
trace_node = Sass::Tree::TraceNode.from_node(node.name, node)
with_environment(env) {
trace_node.children = mixin.tree.map { |c|
d = c.deep_copy
xass_recursive_set_filename(d, node.filename)
visit(c)
}.flatten
}
trace_node
end
end
rescue Sass::SyntaxError => e
e.modify_backtrace(:mixin => node.name, :line => node.line)
e.add_backtrace(:line => node.line)
raise e
end
|