Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 370bee5

Browse files
committed
Clean on_array now that all the nodes are merged
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
1 parent dcc66cb commit 370bee5

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/syntax_tree/parser.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,7 @@ def on_args_new
617617
end
618618

619619
# :call-seq:
620-
# on_array: ((nil | Args | Array [ TStringContent ]) contents) ->
621-
# ArrayLiteral | Symbols
620+
# on_array: ((nil | Args | ArrayLilteral) contents) -> ArrayLiteral
622621
def on_array(contents)
623622
if !contents || contents.is_a?(Args)
624623
lbracket = consume_token(LBracket)
@@ -629,22 +628,14 @@ def on_array(contents)
629628
contents: contents,
630629
location: lbracket.location.to(rbracket.location)
631630
)
632-
elsif contents.is_a?(ArrayLiteral)
631+
else
633632
tstring_end = consume_tstring_end(contents.lbracket.location)
634633

635634
ArrayLiteral.new(
636635
lbracket: contents.lbracket,
637636
contents: contents.contents,
638637
location: contents.location.to(tstring_end.location)
639638
)
640-
else
641-
tstring_end = consume_tstring_end(contents.beginning.location)
642-
643-
contents.class.new(
644-
beginning: contents.beginning,
645-
elements: contents.elements,
646-
location: contents.location.to(tstring_end.location)
647-
)
648639
end
649640
end
650641

0 commit comments

Comments
 (0)