File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
lib/elixir_script/passes/translate Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ defmodule ElixirScript.Translate.Function do
134
134
|> Clause . return_last_statement
135
135
|> update_last_call ( state )
136
136
137
- declaration = Helpers . declare ( params , J . identifier ( "__arg_matches__" ) )
137
+ declaration = Helpers . declare_let ( params , J . identifier ( "__arg_matches__" ) )
138
138
139
139
body = [ declaration ] ++ body
140
140
{ patterns , params , guard , body }
Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ defmodule ElixirScript.Translate.Helpers do
111
111
declare ( J . identifier ( name ) , value )
112
112
end
113
113
114
+ def declare_let ( names , value ) when is_list ( names ) do
115
+ declarator = J . variable_declarator (
116
+ J . array_pattern ( names ) ,
117
+ value
118
+ )
119
+
120
+ J . variable_declaration ( [ declarator ] , :let )
121
+ end
122
+
114
123
def declare_let ( name , value ) do
115
124
declarator = J . variable_declarator (
116
125
J . identifier ( name ) ,
You can’t perform that action at this time.
0 commit comments