Skip to content

Commit f684eed

Browse files
committed
Fixed bugs in html module and removed catch from list of js keywords
1 parent f5abddd commit f684eed

File tree

6 files changed

+164
-28
lines changed

6 files changed

+164
-28
lines changed

lib/elixir_script/prelude/html.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ defmodule ElixirScript.Html do
3838
{ inner, attributes } = do_tag(inner, attrs)
3939

4040
quote do
41-
Elixir.VirtualDOM.h(unquote(tag), unquote(attributes), unquote_splicing(inner))
41+
Elixir.VirtualDOM.h(unquote(tag), unquote(attributes), unquote(inner))
4242
end
4343
end
4444

@@ -49,7 +49,7 @@ defmodule ElixirScript.Html do
4949
{ inner, attributes } = do_tag(inner, attributes)
5050

5151
quote do
52-
Elixir.VirtualDOM.h(unquote(tag), unquote(attributes), unquote_splicing(inner))
52+
Elixir.VirtualDOM.h(unquote(tag), unquote(attributes), unquote(inner))
5353
end
5454
end
5555
end

lib/elixir_script/translator.ex

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ defmodule ElixirScript.Translator do
2323
alias ESTree.Tools.Builder, as: JS
2424
alias ElixirScript.Translator.Rewriter
2525

26-
26+
@erlang_modules [
27+
:erlang,
28+
:maps,
29+
:lists,
30+
:gen,
31+
:elixir_errors,
32+
:supervisor,
33+
:application,
34+
:code,
35+
:elixir_utils,
36+
:file
37+
]
2738

2839
@doc """
2940
Translates the given Elixir AST to JavaScript AST. The given `env` is a `ElixirScript.Macro.Env`
@@ -186,7 +197,7 @@ defmodule ElixirScript.Translator do
186197
end
187198
end
188199

189-
defp do_translate({{:., _, [erlang_module, _]}, _, _} = erlang_function_call, env) when erlang_module in [:erlang, :maps, :lists] do
200+
defp do_translate({{:., _, [erlang_module, _]}, _, _} = erlang_function_call, env) when erlang_module in @erlang_modules do
190201
Rewriter.rewrite(erlang_function_call)
191202
|> translate(env)
192203
end

lib/elixir_script/translator/utils.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ defmodule ElixirScript.Translator.Utils do
77
:break,
88
:case,
99
:class,
10-
:catch,
1110
:const,
1211
:continue,
1312
:debugger,

priv/Elixir.js

Lines changed: 147 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/javascript/lib/core/protocol.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class Protocol{
1717
let fun = null;
1818

1919
if(Number.isInteger(thing) && this.hasImplementation(Integer)){
20-
fun = this.registry.get(Core.Integer)[funName];
20+
fun = this.registry.get(Integer)[funName];
2121
}else if(typeof thing === "number" && !Number.isInteger(thing) && this.hasImplementation(Float)){
22-
fun = this.registry.get(Core.Float)[funName];
22+
fun = this.registry.get(Float)[funName];
2323
}else if(this.hasImplementation(thing)){
2424
fun = this.registry.get(thing.constructor)[funName];
2525
}else if(this.fallback){

src/javascript/tests/patterns/defmatch.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,4 @@ describe('defmatch', () => {
143143
expect(fn(new Tuple(1, 2, 3))).to.equal(3);
144144
expect(fn.bind(fn, new Tuple(1, 2, 4))).to.throw("No match for: {1, 2, 4}");
145145
});
146-
147-
148-
149146
});

0 commit comments

Comments
 (0)