Handle nil tags specially to avoid slow method_missing calls. #88

Merged
merged 1 commit into from Oct 1, 2012
@@ -118,6 +118,8 @@ def visit_Psych_Nodes_Sequence o
end
case o.tag
+ when nil
+ register_empty(o)
when '!omap', 'tag:yaml.org,2002:omap'
map = register(o, Psych::Omap.new)
o.children.each { |a|
@@ -130,9 +132,7 @@ def visit_Psych_Nodes_Sequence o
o.children.each { |c| list.push accept c }
list
else
- list = register(o, [])
- o.children.each { |c| list.push accept c }
- list
+ register_empty(o)
end
end
@@ -252,6 +252,12 @@ def register node, object
object
end
+ def register_empty object
+ list = register(object, [])
+ object.children.each { |c| list.push accept c }
+ list
+ end
+
def revive_hash hash, o
@st[o.anchor] = hash if o.anchor