File tree Expand file tree Collapse file tree 7 files changed +10
-30
lines changed
Expand file tree Collapse file tree 7 files changed +10
-30
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ defmodule ElixirScript.Compiler do
2525 @ spec compile ( atom | [ atom ] , [ ] ) :: nil
2626 def compile ( entry_modules , opts \\ [ ] ) do
2727 opts = build_compiler_options ( opts , entry_modules )
28- { :ok , pid } = ElixirScript.State . start_link ( opts )
28+ { :ok , pid } = ElixirScript.State . start_link ( )
2929
3030 entry_modules = List . wrap ( entry_modules )
3131
@@ -37,7 +37,7 @@ defmodule ElixirScript.Compiler do
3737 ElixirScript.Translate . execute ( modules , pid )
3838
3939 modules = ElixirScript.State . list_modules ( pid )
40- result = ElixirScript.Output . execute ( modules , pid )
40+ result = ElixirScript.Output . execute ( modules , pid , opts )
4141
4242 ElixirScript.State . stop ( pid )
4343
Original file line number Diff line number Diff line change @@ -8,17 +8,15 @@ defmodule ElixirScript.Output do
88 @ doc """
99 Takes outputs the JavaScript code in the specified output
1010 """
11- @ spec execute ( [ atom ] , pid ) :: nil
12- def execute ( modules , pid ) do
11+ @ spec execute ( [ atom ] , pid , map ) :: nil
12+ def execute ( modules , pid , opts ) do
1313 modules = modules
1414 |> Enum . filter ( fn { _ , info } -> Map . has_key? ( info , :js_ast ) end )
1515 |> Enum . map ( fn { _module , info } ->
1616 info . js_ast
1717 end
1818 )
1919
20- opts = ModuleState . get_compiler_opts ( pid )
21-
2220 js_modules = ModuleState . js_modules ( pid )
2321 |> Enum . filter ( fn
2422 { _module , _name , nil } -> false
Original file line number Diff line number Diff line change @@ -3,12 +3,10 @@ defmodule ElixirScript.State do
33
44 # Holds the state for the ElixirScript compiler
55
6- def start_link ( compiler_opts ) do
6+ def start_link ( ) do
77 Agent . start_link ( fn ->
88 % {
9- compiler_opts: compiler_opts ,
109 modules: Keyword . new ,
11- refs: [ ] ,
1210 js_modules: [ ]
1311 }
1412 end )
@@ -18,12 +16,6 @@ defmodule ElixirScript.State do
1816 Agent . stop ( pid )
1917 end
2018
21- def get_compiler_opts ( pid ) do
22- Agent . get ( pid , fn ( state ) ->
23- state . compiler_opts
24- end )
25- end
26-
2719 def get_module ( pid , module ) do
2820 Agent . get ( pid , fn ( state ) ->
2921 Keyword . get ( state . modules , module )
@@ -90,16 +82,6 @@ defmodule ElixirScript.State do
9082 end )
9183 end
9284
93- def list_foreign_modules ( pid ) do
94- Agent . get ( pid , fn ( state ) ->
95- state . modules
96- |> Enum . filter ( fn
97- ( % { attributes: [ __foreign_info__: _ ] } ) -> true
98- ( _ ) -> false
99- end )
100- end )
101- end
102-
10385 def list_modules ( pid ) do
10486 Agent . get ( pid , fn ( state ) ->
10587 state . modules
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ defmodule ElixirScript.Translate.Forms.Test do
88
99
1010 setup_all do
11- { :ok , pid } = ElixirScript.State . start_link ( % { } )
11+ { :ok , pid } = ElixirScript.State . start_link ( )
1212
1313 state = % {
1414 pid: pid
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ defmodule ElixirScript.Translate.Forms.Bitstring.Test do
44 alias ESTree.Tools.Builder , as: J
55
66 setup_all do
7- { :ok , pid } = ElixirScript.State . start_link ( % { } )
7+ { :ok , pid } = ElixirScript.State . start_link ( )
88
99 state = % {
1010 pid: pid ,
@@ -27,4 +27,4 @@ defmodule ElixirScript.Translate.Forms.Bitstring.Test do
2727 assert js_ast . right . type == "CallExpression"
2828 end
2929
30- end
30+ end
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ defmodule ElixirScript.Translate.Forms.JS.Test do
44 alias ESTree.Tools.Builder , as: J
55
66 setup_all do
7- { :ok , pid } = ElixirScript.State . start_link ( % { } )
7+ { :ok , pid } = ElixirScript.State . start_link ( )
88
99 state = % {
1010 pid: pid ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ defmodule ElixirScript.Translate.Forms.Map.Test do
66 import PropertyTest
77
88 setup_all do
9- { :ok , pid } = ElixirScript.State . start_link ( % { } )
9+ { :ok , pid } = ElixirScript.State . start_link ( )
1010
1111 state = % {
1212 pid: pid
You can’t perform that action at this time.
0 commit comments