Skip to content

Commit

Permalink
fix: blocks inside paren function calls
Browse files Browse the repository at this point in the history
Closes #11
  • Loading branch information
mhanberg committed Feb 9, 2024
1 parent 586c087 commit 7e61ec2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/spitfire.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1747,12 +1747,16 @@ defmodule Spitfire do
closing = current_meta(parser)
{{token, newlines ++ [{:closing, closing} | meta], []}, parser}
else
old_nestings = parser.nestings
parser = put_in(parser.nestings, [])

{pairs, parser} =
parser
|> next_token()
|> eat_eol()
|> parse_comma_list()
|> parse_comma_list(pre_parse: fn parser -> inc_nesting(parser) end)

parser = put_in(parser, [:nestings], old_nestings)
{pairs, _} = Enum.unzip(pairs)

parser = eat_at(parser, :eol, 1)
Expand Down
7 changes: 7 additions & 0 deletions test/spitfire_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,13 @@ defmodule SpitfireTest do
quote do
Enum.into(unquote(metadata), unquote(escape_metadata(maybe_application)))
end}
''',
~S'''
type bar(
foo do
a
end
)
'''
]

Expand Down

0 comments on commit 7e61ec2

Please sign in to comment.