Skip to content

Commit 94670fd

Browse files
committed
Apply SyntaxTree formatting
Signed-off-by: Alexandre Terrasa <[email protected]>
1 parent 370bee5 commit 94670fd

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

lib/syntax_tree/parser.rb

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,10 +3036,7 @@ def on_qsymbols_new
30363036

30373037
ArrayLiteral.new(
30383038
lbracket: beginning,
3039-
contents: Args.new(
3040-
parts: [],
3041-
location: beginning.location
3042-
),
3039+
contents: Args.new(parts: [], location: beginning.location),
30433040
location: beginning.location
30443041
)
30453042
end
@@ -3083,10 +3080,7 @@ def on_qwords_new
30833080

30843081
ArrayLiteral.new(
30853082
lbracket: beginning,
3086-
contents: Args.new(
3087-
parts: [],
3088-
location: beginning.location
3089-
),
3083+
contents: Args.new(parts: [], location: beginning.location),
30903084
location: beginning.location
30913085
)
30923086
end
@@ -3653,10 +3647,7 @@ def on_symbols_new
36533647

36543648
ArrayLiteral.new(
36553649
lbracket: beginning,
3656-
contents: Args.new(
3657-
parts: [],
3658-
location: beginning.location
3659-
),
3650+
contents: Args.new(parts: [], location: beginning.location),
36603651
location: beginning.location
36613652
)
36623653
end
@@ -4110,10 +4101,7 @@ def on_words_new
41104101

41114102
ArrayLiteral.new(
41124103
lbracket: beginning,
4113-
contents: Args.new(
4114-
parts: [],
4115-
location: beginning.location
4116-
),
4104+
contents: Args.new(parts: [], location: beginning.location),
41174105
location: beginning.location
41184106
)
41194107
end

lib/syntax_tree/translation/parser.rb

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,27 @@ def visit_array(node)
257257
if node.contents.nil?
258258
[]
259259
elsif node.lbracket.is_a?(QSymbolsBeg)
260-
visit_all(node.contents.parts.map do |part|
261-
SymbolLiteral.new(value: part, location: part.location)
262-
end)
263-
elsif node.lbracket.is_a?(SymbolsBeg)
264-
visit_all(node.contents.parts.map do |element|
265-
part = element.parts.first
266-
267-
if element.parts.length == 1 && part.is_a?(TStringContent)
260+
visit_all(
261+
node.contents.parts.map do |part|
268262
SymbolLiteral.new(value: part, location: part.location)
269-
else
270-
DynaSymbol.new(
271-
parts: element.parts,
272-
quote: nil,
273-
location: element.location
274-
)
275263
end
276-
end)
264+
)
265+
elsif node.lbracket.is_a?(SymbolsBeg)
266+
visit_all(
267+
node.contents.parts.map do |element|
268+
part = element.parts.first
269+
270+
if element.parts.length == 1 && part.is_a?(TStringContent)
271+
SymbolLiteral.new(value: part, location: part.location)
272+
else
273+
DynaSymbol.new(
274+
parts: element.parts,
275+
quote: nil,
276+
location: element.location
277+
)
278+
end
279+
end
280+
)
277281
else
278282
visit_all(node.contents.parts)
279283
end,

0 commit comments

Comments
 (0)