We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f57bba9 commit 4f982c0Copy full SHA for 4f982c0
lib/elixir_script/passes/translate/forms/pattern.ex
@@ -62,7 +62,7 @@ defmodule ElixirScript.Translate.Forms.Pattern do
62
end
63
64
defp process_pattern({:_, _, _}, _) do
65
- { [PM.parameter()], [J.identifier(:_)] }
+ { [PM.parameter(J.literal("_"))], [] }
66
67
68
defp process_pattern({a, b}, state) do
@@ -92,6 +92,14 @@ defmodule ElixirScript.Translate.Forms.Pattern do
92
{ [PM.type(tuple, pattern)], params }
93
94
95
+ defp process_pattern([{:|, _, [head, tail]}], state) do
96
+ { head_patterns, head_params } = process_pattern(head, state)
97
+ { tail_patterns, tail_params } = process_pattern(tail, state)
98
+ params = head_params ++ tail_params
99
+
100
+ { [PM.head_tail(hd(head_patterns), hd(tail_patterns))], params }
101
+ end
102
103
defp process_pattern(list, state) when is_list(list) do
104
{ patterns, params } = list
105
|> Enum.map(&do_compile([&1], state))
lib/elixir_script/passes/translate/forms/remote.ex
@@ -16,7 +16,8 @@ defmodule ElixirScript.Translate.Forms.Remote do
16
:code,
17
:elixir_utils,
18
:file,
19
- :io
+ :io,
20
+ :binary
21
]
22
23
@doc """
package.json
@@ -13,7 +13,7 @@
13
"clean": "rm -rf priv/build",
14
"test": "nyc ava src/javascript/tests",
15
"build:test-app": "MIX_ENV=test mix elixirscript Main -f common -o test/app/build/",
- "test-app": "yarn run build:test-app && NODE_ENV=test ava 'test/app/spec/**/*.spec.js'"
+ "test-app": "yarn build:test-app && NODE_ENV=test ava 'test/app/spec/**/*.spec.js'"
},
"repository": {
"type": "git",
@@ -23,7 +23,7 @@
"license": "MIT",
24
"dependencies": {
25
"erlang-types": "^1.0.1",
26
- "tailored": "^2.6.1"
+ "tailored": "^2.6.3"
27
28
"devDependencies": {
29
"ava": "^0.21.0",
priv/build/iife/ElixirScript.Core.js
src/javascript/lib/core.js
@@ -7,6 +7,7 @@ import maps from './core/erlang_compat/maps';
7
import lists from './core/erlang_compat/lists';
8
import elixir_errors from './core/erlang_compat/elixir_errors';
9
import io from './core/erlang_compat/io';
10
+import binary from './core/erlang_compat/binary';
11
import Store from './core/store';
12
class Integer {}
@@ -45,5 +46,6 @@ export default {
45
46
maps,
47
lists,
48
elixir_errors,
- io
49
+ io,
50
+ binary
51
};
src/javascript/lib/core/erlang_compat/binary.js
@@ -0,0 +1,7 @@
1
+function copy(subject, n = 1) {
2
+ return subject.repeat(n);
3
+}
4
5
+export default {
6
+ copy
+};
test/support/main.ex
@@ -1,5 +1,7 @@
defmodule Main do
def start(:normal, [callback]) do
callback.("started")
+ IO.inspect 1
yarn.lock
@@ -605,10 +605,6 @@ babel-plugin-syntax-exponentiation-operator@^6.8.0:
605
version "6.13.0"
606
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"
607
608
-babel-plugin-syntax-object-rest-spread@^6.8.0:
609
- version "6.13.0"
610
- resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
611
-
612
babel-plugin-syntax-trailing-function-commas@^6.20.0, babel-plugin-syntax-trailing-function-commas@^6.22.0:
613
version "6.22.0"
614
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3"
@@ -813,13 +809,6 @@ babel-plugin-transform-minify-booleans@^6.8.2:
813
809
version "6.8.2"
814
810
resolved "https://registry.yarnpkg.com/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.8.2.tgz#8451579f706e702c1e1ab2756de5c8ea369cf07c"
815
811
816
-babel-plugin-transform-object-rest-spread@^6.23.0:
817
- version "6.23.0"
818
- resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921"
819
- dependencies:
820
- babel-plugin-syntax-object-rest-spread "^6.8.0"
821
- babel-runtime "^6.22.0"
822
823
812
babel-plugin-transform-property-literals@^6.8.4:
824
version "6.8.4"
825
resolved "https://registry.yarnpkg.com/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.8.4.tgz#6ad311110b80a192a56efb5ddf4fe3ca6f7a61da"
@@ -3689,9 +3678,9 @@ table@^4.0.1:
3689
3678
slice-ansi "0.0.4"
3690
3679
string-width "^2.0.0"
3691
3680
3692
-tailored@^2.6.1:
3693
- version "2.6.1"
3694
- resolved "https://registry.yarnpkg.com/tailored/-/tailored-2.6.1.tgz#afac1114f4622eceba11d87fcc35b42a658ded84"
3681
+tailored@^2.6.3:
3682
+ version "2.6.3"
3683
+ resolved "https://registry.yarnpkg.com/tailored/-/tailored-2.6.3.tgz#27d1069dd3f5b2f2009d6437efcb26c595bccfda"
3695
3684
dependencies:
3696
3685
erlang-types "^1.0.1"
3697
3686
0 commit comments