mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] Don't violate #children's typing in Tree::CommentNode.
This commit is contained in:
parent
d39d2eba13
commit
ebd8872b8e
2 changed files with 7 additions and 11 deletions
|
@ -186,10 +186,10 @@ END
|
|||
node.line = line.index
|
||||
node.filename = line.filename
|
||||
|
||||
unless node.is_a?(Tree::CommentNode)
|
||||
append_children(node, line.children, false)
|
||||
if node.is_a?(Tree::CommentNode)
|
||||
node.lines = line.children
|
||||
else
|
||||
node.children = line.children
|
||||
append_children(node, line.children, false)
|
||||
end
|
||||
return node
|
||||
end
|
||||
|
|
|
@ -2,15 +2,17 @@ require 'sass/tree/node'
|
|||
|
||||
module Sass::Tree
|
||||
class CommentNode < Node
|
||||
attr_accessor :lines
|
||||
attr_accessor :value
|
||||
|
||||
def initialize(value, options)
|
||||
@lines = []
|
||||
@value = value[2..-1].strip
|
||||
super(options)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
self.value == other.value && super
|
||||
self.class == other.class && value == other.value && lines == other.lines
|
||||
end
|
||||
|
||||
def silent?
|
||||
|
@ -21,14 +23,8 @@ module Sass::Tree
|
|||
return if (@style == :compressed || silent?)
|
||||
|
||||
spaces = ' ' * (tabs - 1)
|
||||
spaces + "/* " + ([value] + children.map {|c| c.text}).
|
||||
spaces + "/* " + ([value] + lines.map {|l| l.text}).
|
||||
map{|l| l.sub(%r{ ?\*/ *$},'')}.join(@style == :compact ? ' ' : "\n#{spaces} * ") + " */"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def _perform(environment)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue