Skip to content

Commit 51cc052

Browse files
committed
Emit AST for :re.import
1 parent dfa7d58 commit 51cc052

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6657,7 +6657,16 @@ defmodule Kernel do
66576657
# TODO: Remove this when we require Erlang/OTP 28.1+
66586658
is_binary(binary_or_tuple) and Code.ensure_loaded?(:re) and
66596659
function_exported?(:re, :import, 1) ->
6660-
Macro.escape(Regex.compile_export!(binary_or_tuple, bin_opts))
6660+
%{re_pattern: exported_pattern, source: source, opts: opts} =
6661+
Regex.compile_export!(binary_or_tuple, bin_opts)
6662+
6663+
quote do
6664+
%Regex{
6665+
re_pattern: :re.import(unquote(Macro.escape(exported_pattern))),
6666+
source: unquote(source),
6667+
opts: unquote(opts)
6668+
}
6669+
end
66616670

66626671
true ->
66636672
quote(do: Regex.compile!(unquote(binary_or_tuple), unquote(bin_opts)))

0 commit comments

Comments
 (0)