Skip to content

Commit

Permalink
Fix for Sourceror.strip_meta/1
Browse files Browse the repository at this point in the history
Don't return the result of `Macro.prewalk`, only the actual AST
  • Loading branch information
bcardarella committed Jul 24, 2024
1 parent 2a0afcc commit 2715dfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/sourceror.ex
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ defmodule Sourceror do
{name, _meta, args}, acc -> {{name, {}, args}, acc}
other, acc -> {other, acc}
end)
|> elem(0)
end

defp do_patch_string(lines, [], seen, _), do: Enum.reverse(lines) ++ seen
Expand Down
6 changes: 3 additions & 3 deletions test/sourceror_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,9 +1238,9 @@ defmodule SourcerorTest do
quoted = Sourceror.parse_string!(original)

assert Sourceror.strip_meta(quoted) == {
{:hello, {},
[{:world, {}, nil}, [{{:__block__, {}, [:do]}, {:__block__, {}, [:ok]}}]]},
[]
:hello,
{},
[{:world, {}, nil}, [{{:__block__, {}, [:do]}, {:__block__, {}, [:ok]}}]]
}
end
end
Expand Down

0 comments on commit 2715dfd

Please sign in to comment.