@@ -21,54 +21,54 @@ defmodule ElixirScript.Compiler.Deps do
2121 def get_module_filepath_map ( env \\ Mix . env ) do
2222 deps_paths = get_deps_paths ( env )
2323
24- Enum . reduce ( deps_paths , Map . new , fn ( { dep , paths } , map ) ->
24+ Enum . reduce ( deps_paths , [ ] , fn ( { dep , paths } , list ) ->
2525
2626 file_paths = Enum . flat_map ( paths , fn ( path ) ->
2727 path = Path . join ( path , "**/*.{ex,exs,exjs}" )
2828 |> Path . wildcard
2929 end )
3030
31- file_paths = Enum . reduce ( file_paths , Map . new , fn ( path , map ) ->
31+ file_paths = Enum . reduce ( file_paths , [ ] , fn ( path , list ) ->
3232 quoted = path
3333 |> File . read!
3434 |> Code . string_to_quoted!
3535
36- { _ , modules } = Macro . postwalk ( quoted , % { protocols: [ ] , modules: [ ] , impls: [ ] } , & get_defmodules ( & 1 , & 2 ) )
36+ { _ , modules } = Macro . postwalk ( quoted , [ ] , & get_defmodules ( & 1 , & 2 ) )
3737
38- { path , modules }
39- Map . put ( map , path , modules )
38+ modules = Enum . map ( modules , fn ( x ) -> { x . module , Map . put ( x , : path, path ) |> Map . put ( :app , dep ) } end )
39+ list ++ modules
4040 end )
4141
42- { dep , file_paths }
43- Map . put ( map , dep , file_paths )
42+
43+ list ++ file_paths
4444 end )
4545
4646 end
4747
4848
4949 defp get_defmodules ( { :defprotocol , _ , [ { :__aliases__ , _ , _ } = the_alias , _ ] } = ast , state ) do
50- state = Map . update! ( state , :protocols , fn ( l ) -> [ Utils . quoted_to_name ( the_alias ) | l ] end )
51- { ast , state }
50+ s = % { module: Utils . quoted_to_name ( the_alias ) , type: :protocol }
51+ { ast , state ++ [ s ] }
5252 end
5353
5454 defp get_defmodules ( { :defprotocol , _ , [ { :__aliases__ , _ , _ } = the_alias , _ ] } = ast , state ) do
55- state = Map . update! ( state , :protocols , fn ( l ) -> [ Utils . quoted_to_name ( the_alias ) | l ] end )
56- { ast , state }
55+ s = % { module: Utils . quoted_to_name ( the_alias ) , type: :protocol }
56+ { ast , state ++ [ s ] }
5757 end
5858
5959 defp get_defmodules ( { :defimpl , _ , [ { :__aliases__ , _ , _ } = the_alias , [ for: type ] , _ ] } = ast , state ) do
60- state = Map . update! ( state , :impls , fn ( l ) -> [ { Utils . quoted_to_name ( the_alias ) , Utils . quoted_to_name ( type ) } | l ] end )
61- { ast , state }
60+ s = % { module: Utils . quoted_to_name ( the_alias ) , type: :impl , for: Utils . quoted_to_name ( type ) }
61+ { ast , state ++ [ s ] }
6262 end
6363
6464 defp get_defmodules ( { :defimpl , _ , [ { :__aliases__ , _ , _ } = the_alias , [ for: type ] , _ ] } = ast , state ) do
65- state = Map . update! ( state , :impls , fn ( l ) -> [ { Utils . quoted_to_name ( the_alias ) , Utils . quoted_to_name ( type ) } | l ] end )
66- { ast , state }
65+ s = % { module: Utils . quoted_to_name ( the_alias ) , type: :impl , for: Utils . quoted_to_name ( type ) }
66+ { ast , state ++ [ s ] }
6767 end
6868
6969 defp get_defmodules ( { :defmodule , _ , [ { :__aliases__ , _ , _ } = the_alias , [ do: _ ] ] } = ast , state ) do
70- state = Map . update! ( state , :modules , fn ( l ) -> [ Utils . quoted_to_name ( the_alias ) | l ] end )
71- { ast , state }
70+ s = % { module: Utils . quoted_to_name ( the_alias ) , type: :module }
71+ { ast , state ++ [ s ] }
7272 end
7373
7474 defp get_defmodules ( ast , state ) do
0 commit comments