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/while_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

31 lines
833 B
Ruby

require 'sass/tree/node'
module Sass::Tree
# A dynamic node representing a Sass `@while` loop.
#
# @see Sass::Tree
class WhileNode < Node
# @param expr [Script::Node] The parse tree for the continue expression
def initialize(expr)
@expr = expr
super()
end
protected
# Runs the child nodes until the continue expression becomes false.
#
# @param environment [Sass::Environment] The lexical environment containing
# variable and mixin values
# @return [Array<Tree::Node>] The resulting static nodes
# @see Sass::Tree
def _perform(environment)
children = []
new_environment = Sass::Environment.new(environment)
while @expr.perform(environment).to_bool
children += perform_children(new_environment)
end
children
end
end
end