Skip to content

Commit

Permalink
minor collect_implementations cleanup (#9506)
Browse files Browse the repository at this point in the history
* minor collect_implementations cleanup

did while trying to figure out #9504

* don't process already processed classes in collect_implementations

this can happen a lot with interfaces involved, also this workarounds messy cl_dependants situation (see #9504 (comment))
  • Loading branch information
RealyUniqueName committed Jun 18, 2020
1 parent 0df5eb7 commit b7c9dc4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions extra/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
all : fixed super constructor call when extending externs (#7837, #9501)
display : fixed completion for out-of-bounds argument in a call (#9435)
display : fixed "find references" through interfaces (#9470)
display : optimized "find references" (#9504)
macro : fixed type intersection syntax in macro reification (#9404)
lua : fixed lua code generation without `--main` compilation argument (#9489)
php : added an overload signature for `session_set_cookie_params` function (#9507)
Expand Down
31 changes: 17 additions & 14 deletions src/context/display/statistics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,24 @@ let collect_statistics ctx pfilter with_expressions =
) c.cl_overrides
in
let collect_implementations c =
List.iter (fun cf ->
let rec loop c =
begin try
let cf' = PMap.find cf.cf_name c.cl_fields in
add_relation cf.cf_name_pos (Implemented,cf'.cf_name_pos)
with Not_found ->
()
end;
List.iter loop c.cl_descendants
in
List.iter loop c.cl_descendants
) c.cl_ordered_fields;
let memo = Hashtbl.create 0 in
let rec loop c' =
add_relation c.cl_name_pos ((if c'.cl_interface then Extended else Implemented),c'.cl_name_pos);
List.iter loop c'.cl_descendants
if not (Hashtbl.mem memo c'.cl_path) then begin
Hashtbl.add memo c'.cl_path true;
if c'.cl_interface then
add_relation c.cl_name_pos (Extended,c'.cl_name_pos)
else begin
add_relation c.cl_name_pos (Implemented,c'.cl_name_pos);
List.iter (fun cf ->
try
let cf' = PMap.find cf.cf_name c'.cl_fields in
add_relation cf.cf_name_pos (Implemented,cf'.cf_name_pos)
with Not_found ->
()
) c.cl_ordered_fields
end;
List.iter loop c'.cl_descendants
end
in
List.iter loop c.cl_descendants
in
Expand Down

0 comments on commit b7c9dc4

Please sign in to comment.