|
@@ -135,29 +135,26 @@ object(self)
|
|
in
|
|
in
|
|
loop td.t_type
|
|
loop td.t_type
|
|
|
|
|
|
- method identify (accept_anons : bool) (t : Type.t) =
|
|
|
|
- match t with
|
|
|
|
- | TType(td,tl) ->
|
|
|
|
- begin try
|
|
|
|
- Some (Hashtbl.find pfms td.t_path)
|
|
|
|
- with Not_found ->
|
|
|
|
- self#identify accept_anons (apply_typedef td tl)
|
|
|
|
- end
|
|
|
|
- | TMono {tm_type = Some t} ->
|
|
|
|
- self#identify accept_anons t
|
|
|
|
- | TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) ->
|
|
|
|
- self#identify accept_anons (Abstract.get_underlying_type a tl)
|
|
|
|
- | TAbstract({a_path=([],"Null")},[t]) ->
|
|
|
|
- self#identify accept_anons t
|
|
|
|
- | TLazy f ->
|
|
|
|
- self#identify accept_anons (lazy_type f)
|
|
|
|
- | TAnon an when accept_anons && not (PMap.is_empty an.a_fields) ->
|
|
|
|
|
|
+ method identity_anon (an : tanon) =
|
|
|
|
+ let make_pfm path = {
|
|
|
|
+ pfm_path = path;
|
|
|
|
+ pfm_params = [];
|
|
|
|
+ pfm_fields = an.a_fields;
|
|
|
|
+ pfm_converted = None;
|
|
|
|
+ pfm_arity = count_fields an.a_fields;
|
|
|
|
+ } in
|
|
|
|
+ match !(an.a_status) with
|
|
|
|
+ | ClassStatics {cl_path = path} | EnumStatics {e_path = path} | AbstractStatics {a_path = path} ->
|
|
|
|
+ let pfm = make_pfm path in
|
|
|
|
+ self#add_pfm path pfm;
|
|
|
|
+ Some pfm
|
|
|
|
+ | _ ->
|
|
let arity = PMap.fold (fun cf i ->
|
|
let arity = PMap.fold (fun cf i ->
|
|
replace_mono cf.cf_type;
|
|
replace_mono cf.cf_type;
|
|
i + 1
|
|
i + 1
|
|
) an.a_fields 0 in
|
|
) an.a_fields 0 in
|
|
begin try
|
|
begin try
|
|
- Some (self#find_compatible arity t)
|
|
|
|
|
|
+ Some (self#find_compatible arity (TAnon an))
|
|
with Not_found ->
|
|
with Not_found ->
|
|
let id = num in
|
|
let id = num in
|
|
num <- num + 1;
|
|
num <- num + 1;
|
|
@@ -171,7 +168,26 @@ object(self)
|
|
} in
|
|
} in
|
|
self#add_pfm path pfm;
|
|
self#add_pfm path pfm;
|
|
Some pfm
|
|
Some pfm
|
|
- end;
|
|
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ method identify (accept_anons : bool) (t : Type.t) =
|
|
|
|
+ match t with
|
|
|
|
+ | TType(td,tl) ->
|
|
|
|
+ begin try
|
|
|
|
+ Some (Hashtbl.find pfms td.t_path)
|
|
|
|
+ with Not_found ->
|
|
|
|
+ self#identify accept_anons (apply_typedef td tl)
|
|
|
|
+ end
|
|
|
|
+ | TMono {tm_type = Some t} ->
|
|
|
|
+ self#identify accept_anons t
|
|
|
|
+ | TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) ->
|
|
|
|
+ self#identify accept_anons (Abstract.get_underlying_type a tl)
|
|
|
|
+ | TAbstract({a_path=([],"Null")},[t]) ->
|
|
|
|
+ self#identify accept_anons t
|
|
|
|
+ | TLazy f ->
|
|
|
|
+ self#identify accept_anons (lazy_type f)
|
|
|
|
+ | TAnon an when accept_anons && not (PMap.is_empty an.a_fields) ->
|
|
|
|
+ self#identity_anon an
|
|
| _ ->
|
|
| _ ->
|
|
None
|
|
None
|
|
end
|
|
end
|