@@ -41,9 +41,9 @@ import(Meta, Ref, Opts, Selector, S) ->
4141 false -> S ;
4242 true ->
4343 FunctionsFun = fun (K ) -> remove_underscored (K andalso Selector , get_functions (Ref )) end ,
44- Functions = calculate (Meta , Ref , Opts ,
45- S # elixir_scope .functions , FunctionsFun , S ),
46- S # elixir_scope {functions = Functions }
44+ { Functions , TempF } = calculate (Meta , Ref , Opts ,
45+ S # elixir_scope .functions , S # elixir_scope . macro_functions , FunctionsFun , S ),
46+ S # elixir_scope {functions = Functions , macro_functions = TempF }
4747 end ,
4848
4949 SM = case IncludeAll or (Selector == macros ) of
@@ -55,9 +55,9 @@ import(Meta, Ref, Opts, Selector, S) ->
5555 false -> get_macros (Meta , Ref , SF )
5656 end
5757 end ,
58- Macros = calculate (Meta , Ref , Opts ,
59- SF # elixir_scope .macros , MacrosFun , SF ),
60- SF # elixir_scope {macros = Macros }
58+ { Macros , TempM } = calculate (Meta , Ref , Opts ,
59+ SF # elixir_scope .macros , SF # elixir_scope . macro_macros , MacrosFun , SF ),
60+ SF # elixir_scope {macros = Macros , macro_macros = TempM }
6161 end ,
6262
6363 SM .
@@ -66,9 +66,8 @@ import(Meta, Ref, Opts, Selector, S) ->
6666
6767% % Calculates the imports based on only and except
6868
69- calculate (Meta , Key , Opts , Old , AvailableFun , S ) ->
69+ calculate (Meta , Key , Opts , Old , Temp , AvailableFun , S ) ->
7070 File = S # elixir_scope .file ,
71- All = keydelete (Key , Old ),
7271
7372 New = case keyfind (only , Opts ) of
7473 { only , RawOnly } ->
@@ -88,20 +87,20 @@ calculate(Meta, Key, Opts, Old, AvailableFun, S) ->
8887 Except = expand_fun_arity (Meta , except , RawExcept , S ),
8988 case keyfind (Key , Old ) of
9089 false -> AvailableFun (true ) -- Except ;
91- {Key ,ToRemove } -> ToRemove -- Except
90+ {Key ,OldImports } -> OldImports -- Except
9291 end
9392 end
9493 end ,
9594
9695 % % Normalize the data before storing it
97- Set = ordsets :from_list (New ),
98- Final = remove_internals (Set ),
96+ Set = ordsets :from_list (New ),
97+ Final = remove_internals (Set ),
9998
10099 case Final of
101- [] -> All ;
100+ [] -> { keydelete ( Key , Old ), keydelete ( Key , Temp ) } ;
102101 _ ->
103102 ensure_no_in_erlang_macro_conflict (Meta , File , Key , Final , internal_conflict ),
104- [{ Key , Final }|All ]
103+ { [{ Key , Final }|keydelete ( Key , Old )], [{ Key , Final }| keydelete ( Key , Temp )] }
105104 end .
106105
107106% % Ensure we are expanding macros and stuff
0 commit comments