fix: add lexical scope to DSL for imports

This commit is contained in:
Zach Daniel 2020-08-17 02:42:59 -04:00
parent fdc427f20f
commit 0e373f69a6
No known key found for this signature in database
GPG key ID: C377365383138D4B

View file

@ -632,6 +632,8 @@ defmodule Ash.Dsl.Extension do
arg_values = unquote(args)
quote do
# This `try do` block scopes the imports/unimports properly
try do
section_path = unquote(section_path)
entity_name = unquote(entity_name)
extension = unquote(extension)
@ -726,6 +728,9 @@ defmodule Ash.Dsl.Extension do
{__MODULE__, :ash, section_path ++ unquote(nested_entity_path)},
new_config
)
rescue
e -> reraise e, __STACKTRACE__
end
end
end
end,