Skip to content

Commit cf321a5

Browse files
committed
Update tailored. Add names to variables.
1 parent cc6e624 commit cf321a5

5 files changed

Lines changed: 16 additions & 17 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ defmodule ElixirScript.Translate.Forms.Pattern do
203203
end
204204

205205
defp process_pattern({var, _, _}, _) do
206-
{ [PM.parameter()], [ElixirScript.Translate.Identifier.make_identifier(var)] }
206+
{ [PM.parameter(J.literal(to_string(var)))], [ElixirScript.Translate.Identifier.make_identifier(var)] }
207207
end
208208

209209
defp reduce_patterns(patterns, _) do

lib/elixir_script/passes/translate/forms/pattern/patterns.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ defmodule ElixirScript.Translate.Forms.Pattern.Patterns do
5353
)
5454
end
5555

56+
def parameter(name) do
57+
J.call_expression(
58+
@parameter,
59+
[name]
60+
)
61+
end
62+
5663
def head_tail(headParameter, tailParameter) do
5764
J.call_expression(
5865
@head_tail,
@@ -94,4 +101,4 @@ defmodule ElixirScript.Translate.Forms.Pattern.Patterns do
94101
values
95102
)
96103
end
97-
end
104+
end

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"license": "MIT",
2424
"dependencies": {
2525
"erlang-types": "^1.0.1",
26-
"tailored": "^2.4.9"
26+
"tailored": "^2.5.0"
2727
},
2828
"devDependencies": {
2929
"ava": "^0.19.1",
@@ -41,7 +41,9 @@
4141
"sinon": "^1.17.7"
4242
},
4343
"ava": {
44-
"require": ["babel-register"],
44+
"require": [
45+
"babel-register"
46+
],
4547
"babel": {
4648
"babelrc": true
4749
}

test/support/main.ex

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
defmodule Main do
22
def start(:normal, [callback]) do
33
callback.("started")
4-
5-
opts = %{width: 10, height: 15}
6-
with {:ok, width} <- Map.fetch(opts, :width),
7-
{:ok, height} <- Map.fetch(opts, :height)
8-
do
9-
{:ok, width * height}
10-
else
11-
:error ->
12-
{:error, :wrong_data}
13-
end
144
end
155
end

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,9 +3771,9 @@ table@^3.7.8:
37713771
slice-ansi "0.0.4"
37723772
string-width "^2.0.0"
37733773

3774-
tailored@^2.4.9:
3775-
version "2.4.9"
3776-
resolved "https://registry.yarnpkg.com/tailored/-/tailored-2.4.9.tgz#b06ea7e8eab054860062b076e7e1d0e33e0fa983"
3774+
tailored@^2.5.0:
3775+
version "2.5.0"
3776+
resolved "https://registry.yarnpkg.com/tailored/-/tailored-2.5.0.tgz#55055ea25e018951ecfc9adf39177f178fcde63e"
37773777
dependencies:
37783778
erlang-types "^1.0.0"
37793779

0 commit comments

Comments
 (0)