Skip to content

Commit 20f893d

Browse files
committed
Remove a bunch of warnings
1 parent 2535be9 commit 20f893d

File tree

20 files changed

+41
-69
lines changed

20 files changed

+41
-69
lines changed

lib/elixir_script/cli.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ defmodule ElixirScript.CLI do
5454
end
5555

5656
def process(:help) do
57-
IO.write help_message
57+
IO.write help_message()
5858
end
5959

6060
def process(:version) do
@@ -101,7 +101,7 @@ defmodule ElixirScript.CLI do
101101
end
102102

103103
defp handle_input(input) do
104-
input = input
104+
input
105105
|> Enum.map(fn(x) -> String.split(x, [" ", ","], trim: true) end)
106106
|> List.flatten
107107
|> Enum.map(fn(x) -> Module.concat([x]) end)

lib/elixir_script/module_systems/common.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
defmodule ElixirScript.ModuleSystems.Common do
22
@moduledoc false
33
alias ESTree.Tools.Builder, as: JS
4-
alias ElixirScript.Translator
5-
alias ElixirScript.Translator.{State, Utils}
64

75
def build(imports, js_imports, body, exports) do
86
module_imports = Enum.map(imports, fn {module, path} -> import_module(module, path) end)

lib/elixir_script/module_systems/namespace.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule ElixirScript.ModuleSystems.Namespace do
33
alias ESTree.Tools.Builder, as: JS
44
alias ElixirScript.Translate.Identifier
55

6-
def build(module_name, body, exports, env) do
6+
def build(module_name, body, exports) do
77
List.wrap(make_namespace_body(module_name, body, exports))
88
end
99

@@ -28,7 +28,7 @@ defmodule ElixirScript.ModuleSystems.Namespace do
2828
defp make_namespace_body(module_name, body, exports) do
2929
values = module_name_function_call(module_name, "__exports")
3030

31-
_if = JS.if_statement(
31+
js_if = JS.if_statement(
3232
values,
3333
JS.return_statement(values)
3434
)
@@ -62,7 +62,7 @@ defmodule ElixirScript.ModuleSystems.Namespace do
6262
JS.identifier("__load")
6363
)
6464

65-
func_body = JS.block_statement([_if] ++ body ++ [declaration, assign] ++ exports)
65+
func_body = JS.block_statement([js_if] ++ body ++ [declaration, assign] ++ exports)
6666

6767
func = JS.function_expression([JS.identifier("Elixir")], [], func_body)
6868
JS.assignment_expression(

lib/elixir_script/passes/find_used_functions.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ defmodule ElixirScript.FindUsedFunctions do
9898
walk(tail, state)
9999
end
100100

101-
defp walk({:::, _, _}, state) do
101+
defp walk({:::, _, _}, _) do
102102
nil
103103
end
104104

lib/elixir_script/passes/find_used_modules.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ defmodule ElixirScript.FindUsedModules do
9595
walk(tail, state)
9696
end
9797

98-
defp walk({:::, _, _}, state) do
98+
defp walk({:::, _, _}, _) do
9999
nil
100100
end
101101

@@ -232,7 +232,7 @@ defmodule ElixirScript.FindUsedModules do
232232
walk({function, [], params}, state)
233233
end
234234

235-
defp walk({:., _, [JS, _]}, state) do
235+
defp walk({:., _, [JS, _]}, _) do
236236
nil
237237
end
238238

lib/elixir_script/passes/output.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ defmodule ElixirScript.Output do
1010
"""
1111
@spec execute([atom], pid) :: nil
1212
def execute(modules, pid) do
13-
modules = Enum.filter_map(modules, fn {_, info} -> Map.has_key?(info, :js_ast) end,
14-
fn {_module, info} ->
13+
modules = modules
14+
|> Enum.filter(fn {_, info} -> Map.has_key?(info, :js_ast) end)
15+
|> Enum.map(fn {_module, info} ->
1516
info.js_ast
1617
end
1718
)

lib/elixir_script/passes/output/js_module.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ defmodule ElixirScript.Output.JSModule do
1212
elixir = J.variable_declaration([declarator], :const)
1313

1414
table_additions = Enum.map(opts.js_modules, fn
15-
{module, path} -> add_import_to_table(module)
16-
{module, path, _} -> add_import_to_table(module)
15+
{module, _} -> add_import_to_table(module)
16+
{module, _, _} -> add_import_to_table(module)
1717
end)
1818

1919
ast = opts.module_formatter.build(
2020
[],
2121
opts.js_modules,
22-
[elixir, create_atom_table(), start, load] ++ table_additions ++ body,
22+
[elixir, create_atom_table(), start(), load()] ++ table_additions ++ body,
2323
J.identifier("Elixir")
2424
)
2525

lib/elixir_script/passes/translate.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
defmodule ElixirScript.Translate do
22
@moduledoc false
33

4-
alias ElixirScript.State, as: ModuleState
5-
alias ESTree.Tools.{Builder, Generator}
6-
74
@doc """
85
Takes a list of modules and translates their ast into
96
JavaScript AST. The modules are the ones collected from

lib/elixir_script/passes/translate/form.ex

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
defmodule ElixirScript.Translate.Form do
22
alias ESTree.Tools.Builder, as: J
33
alias ElixirScript.Translate.Forms.{Bitstring, Match, Try, For, Receive, Remote, Pattern}
4-
alias ElixirScript.Translate.Functions.{Erlang, Lists, Maps}
5-
alias ElixirScript.Translate.{Identifier, Clause}
4+
alias ElixirScript.Translate.Clause
65
require Logger
76

87
@moduledoc """
@@ -178,7 +177,7 @@ defmodule ElixirScript.Translate.Form do
178177

179178
def compile({:receive, context, [blocks]}, state) do
180179
line = Keyword.get(context, :line, 1)
181-
{function, arity} = Map.get(state, :function)
180+
{function, _arity} = Map.get(state, :function)
182181
Logger.warn fn() ->
183182
"receive not supported, Module: #{inspect state.module}, Function: #{function}, Line: #{line}"
184183
end
@@ -201,7 +200,7 @@ defmodule ElixirScript.Translate.Form do
201200
Remote.compile(ast, state)
202201
end
203202

204-
def compile({:super, context, params}, state) when is_list(params) do
203+
def compile({:super, _, params}, state) when is_list(params) do
205204
{function_name, _} = Map.get(state, :function)
206205
{var_decs, params} = compile_params(params, state)
207206

@@ -259,7 +258,7 @@ defmodule ElixirScript.Translate.Form do
259258
end
260259
end
261260

262-
def compile({var, _, _} = ast, state) do
261+
def compile({var, _, _}, state) do
263262
var = Pattern.get_variable_name(to_string(var), state)
264263
{ ElixirScript.Translate.Identifier.make_identifier(var), state }
265264
end

lib/elixir_script/passes/translate/forms/bitstring.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ defmodule ElixirScript.Translate.Forms.Bitstring do
9898
defp do_compile_element({type, ast}) do
9999
JS.call_expression(
100100
JS.member_expression(
101-
bitstring_class,
101+
bitstring_class(),
102102
JS.identifier(type)
103103
),
104104
[
@@ -110,7 +110,7 @@ defmodule ElixirScript.Translate.Forms.Bitstring do
110110
defp do_compile_element({type, ast, params}) when is_list(params) do
111111
JS.call_expression(
112112
JS.member_expression(
113-
bitstring_class,
113+
bitstring_class(),
114114
JS.identifier(type)
115115
),
116116
[

0 commit comments

Comments
 (0)