Skip to content

Commit

Permalink
Follow forwardStatics abstract (#11294)
Browse files Browse the repository at this point in the history
  • Loading branch information
RblSb authored and kLabz committed Sep 1, 2023
1 parent 39960a1 commit fb1dee7
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/context/display/displayFields.ml
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,25 @@ let collect ctx e_ast e dk with_type p =
| TAnon an ->
(* @:forwardStatics *)
let items = match !(an.a_status) with
| Statics { cl_kind = KAbstractImpl { a_meta = meta; a_this = TInst (c,_) }} when Meta.has Meta.ForwardStatics meta ->
let items = List.fold_left (fun acc cf ->
if should_access c cf true && is_new_item acc cf.cf_name then begin
let origin = Self(TClassDecl c) in
let item = make_class_field origin cf in
PMap.add cf.cf_name item acc
end else
acc
) items c.cl_ordered_statics in
PMap.foldi (fun name item acc ->
if is_new_item acc name then
PMap.add name item acc
else
acc
) PMap.empty items
| Statics { cl_kind = KAbstractImpl { a_meta = meta; a_this}} when Meta.has Meta.ForwardStatics meta ->
begin match follow a_this with
| TInst (c,_) ->
let items = List.fold_left (fun acc cf ->
if should_access c cf true && is_new_item acc cf.cf_name then begin
let origin = Self(TClassDecl c) in
let item = make_class_field origin cf in
PMap.add cf.cf_name item acc
end else
acc
) items c.cl_ordered_statics in
PMap.foldi (fun name item acc ->
if is_new_item acc name then
PMap.add name item acc
else
acc
) PMap.empty items
| _ -> items
end
| _ -> items
in
(* Anon own fields *)
Expand Down

0 comments on commit fb1dee7

Please sign in to comment.