Skip to content

Commit 79164c8

Browse files
committed
Emit AST for :re.import
1 parent dfa7d58 commit 79164c8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6657,7 +6657,17 @@ 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, re_version: re_version, 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(exported_pattern)),
6666+
re_version: unquote(re_version),
6667+
source: unquote(source),
6668+
opts: unquote(opts)
6669+
}
6670+
end
66616671

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

0 commit comments

Comments
 (0)