Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/generators/genjs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -757,14 +757,16 @@ and gen_function ?(keyword="function") ctx f pos =
else begin
check_var_declaration v;
let non_rest_args = List.rev args_rev in
let args_decl = declare_rest_args_legacy ctx.com (List.length non_rest_args) v in
let body =
let body = if has_var_flag v VUsedByTyper then
let args_decl = declare_rest_args_legacy ctx.com (List.length non_rest_args) v in
let el =
match f.tf_expr.eexpr with
| TBlock el -> args_decl @ el
| _ -> args_decl @ [f.tf_expr]
in
mk (TBlock el) f.tf_expr.etype f.tf_expr.epos
else
f.tf_expr
in
{ f with tf_args = non_rest_args; tf_expr = body }, mk_non_rest_arg_names non_rest_args
end
Expand Down
Loading