|
@@ -164,28 +164,38 @@ let collect ctx e_ast e dk with_type p =
|
|
|
should_access c cf false &&
|
|
|
(not (Meta.has Meta.Impl cf.cf_meta) || Meta.has Meta.Enum cf.cf_meta)
|
|
|
in
|
|
|
- let origin,check = match !(an.a_status) with
|
|
|
+ let ct = DisplayEmitter.completion_type_of_type ctx ~values:(get_value_meta cf.cf_meta) cf.cf_type in
|
|
|
+ let add origin make_field =
|
|
|
+ PMap.add name (make_field (CompletionClassField.make cf CFSMember origin true) (cf.cf_type,ct)) acc
|
|
|
+ in
|
|
|
+ match !(an.a_status) with
|
|
|
| Statics ({cl_kind = KAbstractImpl a} as c) ->
|
|
|
- Self (TAbstractDecl a),allow_static_abstract_access c cf
|
|
|
- | Statics c -> Self (TClassDecl c),should_access c cf true
|
|
|
- | EnumStatics en -> Self (TEnumDecl en),true
|
|
|
+ if allow_static_abstract_access c cf then
|
|
|
+ let make = if Meta.has Meta.Enum cf.cf_meta then
|
|
|
+ (make_ci_enum_abstract_field a)
|
|
|
+ else
|
|
|
+ make_ci_class_field
|
|
|
+ in
|
|
|
+ add (Self (TAbstractDecl a)) make
|
|
|
+ else
|
|
|
+ acc;
|
|
|
+ | Statics c ->
|
|
|
+ if should_access c cf true then add (Self (TClassDecl c)) make_ci_class_field else acc;
|
|
|
+ | EnumStatics en ->
|
|
|
+ let ef = PMap.find name en.e_constrs in
|
|
|
+ PMap.add name (make_ci_enum_field (CompletionEnumField.make ef (Self (TEnumDecl en)) true) (cf.cf_type,ct)) acc
|
|
|
| AbstractStatics a ->
|
|
|
let check = match a.a_impl with
|
|
|
| None -> true
|
|
|
| Some c -> allow_static_abstract_access c cf
|
|
|
in
|
|
|
- Self (TAbstractDecl a),check
|
|
|
+ if check then add (Self (TAbstractDecl a)) make_ci_class_field else acc;
|
|
|
| _ ->
|
|
|
let origin = match t with
|
|
|
| TType(td,_) -> Self (TTypeDecl td)
|
|
|
| _ -> AnonymousStructure an
|
|
|
in
|
|
|
- origin,true
|
|
|
- in
|
|
|
- if check then begin
|
|
|
- let ct = DisplayEmitter.completion_type_of_type ctx ~values:(get_value_meta cf.cf_meta) cf.cf_type in
|
|
|
- PMap.add name (make_ci_class_field (CompletionClassField.make cf CFSMember origin true) (cf.cf_type,ct)) acc
|
|
|
- end else acc
|
|
|
+ add origin make_ci_class_field;
|
|
|
end else
|
|
|
acc
|
|
|
) an.a_fields items
|
|
@@ -220,7 +230,7 @@ let collect ctx e_ast e dk with_type p =
|
|
|
(* Add static extensions *)
|
|
|
let items = collect_static_extensions ctx items e p in
|
|
|
let items = PMap.fold (fun item acc -> item :: acc) items [] in
|
|
|
- let items = sort_fields items Value (TKExpr p) in
|
|
|
+ let items = sort_fields items Value (TKField p) in
|
|
|
try
|
|
|
let sl = string_list_of_expr_path_raise e_ast in
|
|
|
(* Add submodule fields *)
|