1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/sass/tree/file_node.rb
Nathan Weizenbaum 126ee8191b Merge branch 'sassc' into yard-sassc
Conflicts:

	lib/sass.rb
	lib/sass/error.rb
	lib/sass/tree/comment_node.rb
	lib/sass/tree/debug_node.rb
	lib/sass/tree/directive_node.rb
	lib/sass/tree/file_node.rb
	lib/sass/tree/for_node.rb
	lib/sass/tree/if_node.rb
	lib/sass/tree/mixin_def_node.rb
	lib/sass/tree/mixin_node.rb
	lib/sass/tree/node.rb
	lib/sass/tree/while_node.rb
2009-04-25 13:00:22 -07:00

39 lines
1.1 KiB
Ruby

module Sass
module Tree
# A static node that wraps the {Sass::Tree} for an `@import`ed file.
# It doesn't have a functional purpose other than to add the `@import`ed file
# to the backtrace if an error occurs.
class FileNode < Node
# @param filename [String] The name of the imported file
def initialize(filename)
@filename = filename
super()
end
# Computes the CSS for the imported file.
#
# @param args [Array] Ignored
def to_s(*args)
super()
rescue Sass::SyntaxError => e
e.add_backtrace_entry(@filename)
raise e
end
protected
# Parses the imported file
# and runs the dynamic Sass for it.
#
# @param environment [Sass::Environment] The lexical environment containing
# variable and mixin values
def perform!(environment)
self.children = Sass::Files.tree_for(filename, @options).children
self.children = perform_children(environment)
rescue Sass::SyntaxError => e
e.add_backtrace_entry(@filename)
raise e
end
end
end
end