@@ -11,44 +11,50 @@ defmodule IEx.Introspection do
1111 Decomposes an introspection call into `{mod, fun, arity}`,
1212 `{mod, fun}` or `mod`.
1313 """
14- def decompose ( { :/ , _ , [ call , arity ] } = term , context ) do
14+ def decompose ( atom , _context ) when is_atom ( atom ) , do: atom
15+
16+ def decompose ( { :__aliases__ , _ , _ } = module , context ) do
17+ Macro . expand ( module , context )
18+ end
19+
20+ def decompose ( { :/ , _ , [ call , arity ] } , context ) do
1521 case Macro . decompose_call ( call ) do
1622 { _mod , :__info__ , [ ] } when arity == 1 ->
17- { :{} , [ ] , [ Module , :__info__ , 1 ] }
23+ { Module , :__info__ , 1 }
1824
1925 { mod , fun , [ ] } ->
20- { :{} , [ ] , [ mod , fun , arity ] }
26+ { Macro . expand ( mod , context ) , fun , arity }
2127
2228 { fun , [ ] } ->
23- { :{} , [ ] , [ find_decompose_fun_arity ( fun , arity , context ) , fun , arity ] }
29+ { find_decompose_fun_arity ( fun , arity , context ) , fun , arity }
2430
2531 _ ->
26- term
32+ :error
2733 end
2834 end
2935
3036 def decompose ( call , context ) do
3137 case Macro . decompose_call ( call ) do
3238 { _mod , :__info__ , [ ] } ->
33- Macro . escape ( { Module , :__info__ , 1 } )
34-
35- { mod , fun , [ ] } ->
36- { mod , fun }
39+ { Module , :__info__ , 1 }
3740
3841 { maybe_sigil , [ _ , _ ] } ->
3942 case Atom . to_string ( maybe_sigil ) do
4043 "sigil_" <> _ ->
41- { :{} , [ ] , [ find_decompose_fun_arity ( maybe_sigil , 2 , context ) , maybe_sigil , 2 ] }
44+ { find_decompose_fun_arity ( maybe_sigil , 2 , context ) , maybe_sigil , 2 }
4245
4346 _ ->
44- call
47+ :error
4548 end
4649
50+ { mod , fun , [ ] } ->
51+ { Macro . expand ( mod , context ) , fun }
52+
4753 { fun , [ ] } ->
4854 { find_decompose_fun ( fun , context ) , fun }
4955
5056 _ ->
51- call
57+ :error
5258 end
5359 end
5460
0 commit comments