From ccdcaf984dd2be19ac63c0abcd1714e79d8450e4 Mon Sep 17 00:00:00 2001 From: Brian Cardarella Date: Tue, 23 Jul 2024 21:07:09 -0400 Subject: [PATCH] Fix for Sourceror.strip_meta/1 (#160) Don't return the result of `Macro.prewalk`, only the actual AST --- lib/sourceror.ex | 1 + test/sourceror_test.exs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/sourceror.ex b/lib/sourceror.ex index 7b1aa7b..50cfa1b 100644 --- a/lib/sourceror.ex +++ b/lib/sourceror.ex @@ -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 diff --git a/test/sourceror_test.exs b/test/sourceror_test.exs index 2e53e7d..abb0184 100644 --- a/test/sourceror_test.exs +++ b/test/sourceror_test.exs @@ -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