Skip to content

Commit fb42ce6

Browse files
committed
More changes
1 parent 8990e3c commit fb42ce6

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

lib/elixir_script/passes/output/js_module.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule ElixirScript.Output.JSModule do
4444
J.identifier("Elixir"),
4545
J.identifier("start")
4646
),
47-
Helpers.arrow_function(
47+
Helpers.function(
4848
[J.identifier(:app), J.identifier(:args)],
4949
J.block_statement([
5050
start_process_call
@@ -59,7 +59,7 @@ defmodule ElixirScript.Output.JSModule do
5959
J.identifier("Elixir"),
6060
J.identifier("load")
6161
),
62-
Helpers.arrow_function(
62+
Helpers.function(
6363
[J.identifier(:module)],
6464
J.block_statement([
6565
J.return_statement(

lib/elixir_script/passes/translate/clause.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule ElixirScript.Translate.Clause do
1717

1818
body = body
1919
|> return_last_statement
20-
|> Function.update_last_call(state)
20+
#|> Function.update_last_call(state)
2121

2222
ast = Helpers.call(
2323
J.member_expression(

lib/elixir_script/passes/translate/function.ex

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ defmodule ElixirScript.Translate.Function do
1818

1919
arg_matches_declaration = Helpers.declare_let("__arg_matches__", J.identifier("null"))
2020

21-
function_recur_dec = Helpers.function(
22-
"recur",
21+
function_dec = Helpers.arrow_function(
2322
[J.rest_element(J.identifier("__function_args__"))],
2423
J.block_statement([
2524
arg_matches_declaration,
@@ -36,15 +35,15 @@ defmodule ElixirScript.Translate.Function do
3635
])
3736
)
3837

39-
function_dec = Helpers.arrow_function(
40-
[J.rest_element(J.identifier("__function_args__"))],
41-
J.block_statement([
42-
function_recur_dec,
43-
J.return_statement(
44-
trampoline()
45-
)
46-
])
47-
)
38+
#function_dec = Helpers.arrow_function(
39+
# [J.rest_element(J.identifier("__function_args__"))],
40+
# J.block_statement([
41+
# function_recur_dec,
42+
# J.return_statement(
43+
# trampoline()
44+
# )
45+
# ])
46+
#)
4847

4948
state = Map.put(state, :anonymous_fn, anonymous?)
5049
{ function_dec, state }
@@ -59,8 +58,8 @@ defmodule ElixirScript.Translate.Function do
5958

6059
arg_matches_declaration = Helpers.declare_let("__arg_matches__", J.identifier("null"))
6160

62-
function_recur_dec = Helpers.function(
63-
"recur",
61+
function_dec = Helpers.function(
62+
ElixirScript.Translate.Identifier.make_function_name(name),
6463
[J.rest_element(J.identifier("__function_args__"))],
6564
J.block_statement([
6665
arg_matches_declaration,
@@ -77,16 +76,16 @@ defmodule ElixirScript.Translate.Function do
7776
])
7877
)
7978

80-
function_dec = Helpers.function(
81-
ElixirScript.Translate.Identifier.make_function_name(name),
82-
[J.rest_element(J.identifier("__function_args__"))],
83-
J.block_statement([
84-
function_recur_dec,
85-
J.return_statement(
86-
trampoline()
87-
)
88-
])
89-
)
79+
#function_dec = Helpers.function(
80+
# ElixirScript.Translate.Identifier.make_function_name(name),
81+
# [J.rest_element(J.identifier("__function_args__"))],
82+
# J.block_statement([
83+
# function_recur_dec,
84+
# J.return_statement(
85+
# trampoline()
86+
# )
87+
# ])
88+
#)
9089

9190
{ function_dec, state }
9291
end
@@ -135,7 +134,7 @@ defmodule ElixirScript.Translate.Function do
135134

136135
body = body
137136
|> Clause.return_last_statement
138-
|> update_last_call(state)
137+
#|> update_last_call(state)
139138

140139
declaration = Helpers.declare(params, J.identifier("__arg_matches__"))
141140

lib/elixir_script/passes/translate/helpers.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ defmodule ElixirScript.Translate.Helpers do
2828

2929
def call(callee, arguments) do
3030
J.call_expression(
31-
J.member_expression(process_system(), J.identifier("run")),
31+
J.member_expression(core_module("ProcessSystem"), J.identifier("run")),
3232
[
3333
callee,
3434
J.array_expression(arguments)

src/javascript/lib/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ export default {
5959
elixir_config,
6060
math,
6161
proplists,
62+
ProcessSystem
6263
};

src/javascript/lib/core/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import erlang from './erlang_compat/erlang';
77
function* call_property(item, property) {
88
if (!property) {
99
if (item instanceof Function || typeof item === 'function') {
10-
return item();
10+
return yield* item();
1111
}
1212

1313
return item;

0 commit comments

Comments
 (0)