|
@@ -547,15 +547,17 @@ module Builder = struct
|
|
|
let index basic e index t p =
|
|
|
mk (TArray (e,mk (TConst (TInt (Int32.of_int index))) basic.tint p)) t p
|
|
|
|
|
|
- let default_value t p = match follow_without_null t with
|
|
|
- | TAbstract({a_path = ([],"Int")},[]) ->
|
|
|
- mk (TConst (TInt (Int32.zero))) t p
|
|
|
- | TAbstract({a_path = ([],"Float")},[]) ->
|
|
|
- mk (TConst (TFloat "0.0")) t p
|
|
|
- | TAbstract({a_path = ([],"Bool")},[]) ->
|
|
|
- mk (TConst (TBool false)) t p
|
|
|
- | _ ->
|
|
|
+ let rec default_value t p = match t with
|
|
|
+ | TAbstract({a_default = Some f},_) ->
|
|
|
+ {(Lazy.force f) with etype = t; epos = p}
|
|
|
+ | TInst _ | TEnum _ | TAbstract _ | TFun _ | TAnon _ | TDynamic _ | TMono {tm_type = None} ->
|
|
|
mk (TConst TNull) t p
|
|
|
+ | TLazy r ->
|
|
|
+ default_value (lazy_type r) p
|
|
|
+ | TMono {tm_type = Some t} ->
|
|
|
+ default_value t p
|
|
|
+ | TType(td,tl) ->
|
|
|
+ default_value (apply_typedef td tl) p
|
|
|
|
|
|
let resolve_and_make_static_call c name args p =
|
|
|
ignore(c.cl_build());
|