|
@@ -128,9 +128,14 @@ let unify_call_params ctx name el args p inline =
|
|
let arg_error ul name opt p =
|
|
let arg_error ul name opt p =
|
|
raise (Error (Stack (Unify ul,Custom ("For " ^ (if opt then "optional " else "") ^ "function argument '" ^ name ^ "'")), p))
|
|
raise (Error (Stack (Unify ul,Custom ("For " ^ (if opt then "optional " else "") ^ "function argument '" ^ name ^ "'")), p))
|
|
in
|
|
in
|
|
|
|
+ let enull = (match ctx.com.platform with
|
|
|
|
+ | Js -> TLocal "undefined"
|
|
|
|
+ | Flash -> TLocal "__undefined__"
|
|
|
|
+ | _ -> TConst TNull
|
|
|
|
+ ) in
|
|
let rec no_opt = function
|
|
let rec no_opt = function
|
|
| [] -> []
|
|
| [] -> []
|
|
- | ({ eexpr = TConst TNull },true) :: l -> no_opt l
|
|
|
|
|
|
+ | (e,true) :: l when e.eexpr == enull -> no_opt l
|
|
| l -> List.map fst l
|
|
| l -> List.map fst l
|
|
in
|
|
in
|
|
let rec default_value t =
|
|
let rec default_value t =
|
|
@@ -153,7 +158,7 @@ let unify_call_params ctx name el args p inline =
|
|
let e = type_expr ctx infos true in
|
|
let e = type_expr ctx infos true in
|
|
(e, true)
|
|
(e, true)
|
|
else
|
|
else
|
|
- (null t p, true)
|
|
|
|
|
|
+ (mk enull t p, true)
|
|
in
|
|
in
|
|
let rec loop acc l l2 skip =
|
|
let rec loop acc l l2 skip =
|
|
match l , l2 with
|
|
match l , l2 with
|