11defmodule ElixirScript.Passes.HandleOutput do
2- @ moduledoc false
2+ @ moduledoc false
33 alias ElixirScript.Translator.State
44
55 def execute ( compiler_data , opts ) do
@@ -24,12 +24,14 @@ defmodule ElixirScript.Passes.HandleOutput do
2424
2525 defp out ( compiler_output , % { output: nil } = compiler_opts ) do
2626 compiler_output
27- |> process_include_path ( compiler_opts )
27+ |> remove_load_only
28+ |> process_include_path ( compiler_opts )
2829 end
2930
3031 defp out ( compiler_output , % { output: :stdout } = compiler_opts ) do
3132 compiler_output
32- |> process_include_path ( compiler_opts )
33+ |> remove_load_only
34+ |> process_include_path ( compiler_opts )
3335 |> Enum . each ( fn
3436 { _ , code , _ } -> IO . write ( code )
3537 code -> IO . write ( code )
@@ -41,6 +43,8 @@ defmodule ElixirScript.Passes.HandleOutput do
4143 ElixirScript . copy_stdlib_to_destination ( output_path )
4244 end
4345
46+ compiler_output = remove_load_only ( compiler_output )
47+
4448 compiler_output . data
4549 |> Enum . each ( fn ( { _ , x } ) ->
4650 write_to_file ( x , output_path )
@@ -69,4 +73,9 @@ defmodule ElixirScript.Passes.HandleOutput do
6973 end
7074 end )
7175 end
76+
77+ defp remove_load_only ( compiler_output ) do
78+ data = Enum . filter ( compiler_output . data , fn ( { m , d } ) -> Map . get ( d , :load_only , false ) == false end )
79+ % { compiler_output | data: data }
80+ end
7281end
0 commit comments