@@ -5,14 +5,14 @@ defmodule ElixirScript.ModuleSystems.ES do
55 alias ElixirScript.Translator.State
66 alias ElixirScript.Translator.Utils
77
8- def build ( std_import , imports , js_imports , body , exports , env ) do
8+ def build ( std_import , imports , js_imports , body , exports ) do
99 module_imports = Enum . map ( imports , fn { module , path } -> import_module ( module , path ) end )
1010
1111 imports = js_imports ++ List . wrap ( std_import )
1212 |> Enum . map ( fn
13- { module , path } -> import_module ( module , path , env )
14- { module , path , true } -> import_module ( module , path , env )
15- { module , path , false } -> import_namespace_module ( module , path , env )
13+ { module , path } -> import_module ( module , path )
14+ { module , path , true } -> import_module ( module , path )
15+ { module , path , false } -> import_namespace_module ( module , path )
1616 end )
1717
1818 imports = Enum . uniq ( imports ++ module_imports )
@@ -21,47 +21,10 @@ defmodule ElixirScript.ModuleSystems.ES do
2121 imports ++ body ++ export
2222 end
2323
24- defp module_imports_to_js_imports ( module_refs , env ) do
25- Enum . map ( module_refs , fn ( x ) ->
26- module_name = Utils . name_to_js_name ( x )
27- app_name = State . get_module ( env . state , x ) . app
28- path = Utils . make_local_file_path ( app_name , Utils . name_to_js_file_name ( x ) , env )
29- import_module ( module_name , path )
30- end )
31- end
32-
33- defp make_std_lib_import ( env ) do
34- compiler_opts = State . get ( env . state ) . compiler_opts
35- case compiler_opts . import_standard_libs do
36- true ->
37- [ { :Elixir , Utils . make_local_file_path ( :elixir , compiler_opts . core_path , env ) , true } ]
38- false ->
39- [ ]
40- end
41- end
42-
43- def import_namespace_module ( module_name , from , env ) do
24+ def import_namespace_module ( module_name , from ) do
4425 import_specifier = JS . import_namespace_specifier (
45- Translator . translate! ( module_name , env ) ,
46- Translator . translate! ( module_name , env )
47- )
48-
49- do_import_module ( [ import_specifier ] , from )
50- end
51-
52- def import_module ( :Elixir , from , env ) do
53- import_specifier = JS . import_default_specifier (
54- JS . identifier ( "Elixir" ) ,
55- JS . identifier ( "Elixir" )
56- )
57-
58- do_import_module ( [ import_specifier ] , from )
59- end
60-
61- def import_module ( module_name , from , env ) do
62- import_specifier = JS . import_default_specifier (
63- Translator . translate! ( module_name , env ) ,
64- Translator . translate! ( module_name , env )
26+ JS . identifier ( module_name ) ,
27+ JS . identifier ( module_name )
6528 )
6629
6730 do_import_module ( [ import_specifier ] , from )
0 commit comments