mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 19:00:39 -07:00
Merge pull request #444 from Shopify/remove-block-children
Avoid keeping track of two lists of nodes during parsing.
This commit is contained in:
+2
-7
@@ -14,9 +14,6 @@ module Liquid
|
|||||||
@nodelist ||= []
|
@nodelist ||= []
|
||||||
@nodelist.clear
|
@nodelist.clear
|
||||||
|
|
||||||
# All child tags of the current block.
|
|
||||||
@children = []
|
|
||||||
|
|
||||||
while token = tokens.shift
|
while token = tokens.shift
|
||||||
unless token.empty?
|
unless token.empty?
|
||||||
case
|
case
|
||||||
@@ -37,7 +34,6 @@ module Liquid
|
|||||||
new_tag.line_number = token.line_number if token.is_a?(Token)
|
new_tag.line_number = token.line_number if token.is_a?(Token)
|
||||||
@blank &&= new_tag.blank?
|
@blank &&= new_tag.blank?
|
||||||
@nodelist << new_tag
|
@nodelist << new_tag
|
||||||
@children << new_tag
|
|
||||||
else
|
else
|
||||||
# this tag is not registered with the system
|
# this tag is not registered with the system
|
||||||
# pass it to the current block for special handling or error reporting
|
# pass it to the current block for special handling or error reporting
|
||||||
@@ -50,7 +46,6 @@ module Liquid
|
|||||||
new_var = create_variable(token)
|
new_var = create_variable(token)
|
||||||
new_var.line_number = token.line_number if token.is_a?(Token)
|
new_var.line_number = token.line_number if token.is_a?(Token)
|
||||||
@nodelist << new_var
|
@nodelist << new_var
|
||||||
@children << new_var
|
|
||||||
@blank = false
|
@blank = false
|
||||||
else
|
else
|
||||||
@nodelist << token
|
@nodelist << token
|
||||||
@@ -70,8 +65,8 @@ module Liquid
|
|||||||
all_warnings = []
|
all_warnings = []
|
||||||
all_warnings.concat(@warnings) if @warnings
|
all_warnings.concat(@warnings) if @warnings
|
||||||
|
|
||||||
(@children || []).each do |node|
|
(nodelist || []).each do |node|
|
||||||
all_warnings.concat(node.warnings || [])
|
all_warnings.concat(node.warnings || []) if node.respond_to?(:warnings)
|
||||||
end
|
end
|
||||||
|
|
||||||
all_warnings
|
all_warnings
|
||||||
|
|||||||
Reference in New Issue
Block a user