|
@@ -114,6 +114,10 @@ let collect ctx e_ast e dk with_type p =
|
|
|
(not stat || not (Meta.has Meta.Impl cf.cf_meta)) &&
|
|
|
can_access ctx c cf stat
|
|
|
in
|
|
|
+ let make_class_field origin cf =
|
|
|
+ let ct = DisplayEmitter.completion_type_of_type ctx ~values:(get_value_meta cf.cf_meta) cf.cf_type in
|
|
|
+ make_ci_class_field (CompletionClassField.make cf CFSMember origin true) (cf.cf_type,ct)
|
|
|
+ in
|
|
|
let rec loop items t =
|
|
|
let is_new_item items name = not (PMap.mem name items) in
|
|
|
match follow t with
|
|
@@ -127,12 +131,25 @@ let collect ctx e_ast e dk with_type p =
|
|
|
PMap.foldi (fun k (c,cf) acc ->
|
|
|
if should_access c cf false && is_new_item acc cf.cf_name then begin
|
|
|
let origin = if c == c0 then Self(TClassDecl c) else Parent(TClassDecl c) in
|
|
|
- let ct = DisplayEmitter.completion_type_of_type ctx ~values:(get_value_meta cf.cf_meta) cf.cf_type in
|
|
|
- let item = make_ci_class_field (CompletionClassField.make cf CFSMember origin true) (cf.cf_type,ct) in
|
|
|
+ let item = make_class_field origin cf in
|
|
|
PMap.add k item acc
|
|
|
end else
|
|
|
acc
|
|
|
) fields items
|
|
|
+ | TEnum _ ->
|
|
|
+ let t = ctx.g.do_load_type_def ctx p {tpackage=[];tname="EnumValue";tsub=None;tparams=[]} in
|
|
|
+ begin match t with
|
|
|
+ | TAbstractDecl ({a_impl = Some c} as a) ->
|
|
|
+ begin try
|
|
|
+ let cf = PMap.find "match" c.cl_statics in
|
|
|
+ let item = make_class_field (Self(TAbstractDecl a)) cf in
|
|
|
+ PMap.add "match" item items
|
|
|
+ with Not_found ->
|
|
|
+ items
|
|
|
+ end
|
|
|
+ | _ ->
|
|
|
+ items
|
|
|
+ end;
|
|
|
| TAbstract({a_impl = Some c} as a,tl) ->
|
|
|
merge_core_doc ctx (TAbstractDecl a);
|
|
|
(* Abstracts should show all their @:impl fields minus the constructor. *)
|
|
@@ -141,8 +158,7 @@ let collect ctx e_ast e dk with_type p =
|
|
|
let origin = Self(TAbstractDecl a) in
|
|
|
let cf = prepare_using_field cf in
|
|
|
let cf = if tl = [] then cf else {cf with cf_type = apply_params a.a_params tl cf.cf_type} in
|
|
|
- let ct = DisplayEmitter.completion_type_of_type ctx ~values:(get_value_meta cf.cf_meta) cf.cf_type in
|
|
|
- let item = make_ci_class_field (CompletionClassField.make cf CFSMember origin true) (cf.cf_type,ct) in
|
|
|
+ let item = make_class_field origin cf in
|
|
|
PMap.add cf.cf_name item acc
|
|
|
end else
|
|
|
acc
|