Skip to content

Commit

Permalink
[flow][refactor] Remove unused type from Get_def_request.Identifier
Browse files Browse the repository at this point in the history
Summary: Changelog: [internal]

Reviewed By: gkz

Differential Revision: D68004393

fbshipit-source-id: e648be29ca70621f28008d6db74178d47a7dfa7c
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Jan 11, 2025
1 parent 4b2da9f commit 10f17c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/services/get_def/getDef_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let extract_member_def ~loc_of_aloc ~cx ~file_sig ~typed_ast_opt ~force_instance
let rec process_request ~loc_of_aloc ~cx ~is_legit_require ~ast ~typed_ast_opt ~file_sig ~scope_info
: (ALoc.t, ALoc.t * Type.t) Get_def_request.t -> (Loc.t Nel.t * string option, string) result =
function
| Get_def_request.Identifier { name; loc = (aloc, _) } ->
| Get_def_request.Identifier { name; loc = aloc } ->
let loc = loc_of_aloc aloc in
let all_uses = Scope_api.With_Loc.all_uses scope_info in
let matching_uses = Loc_collections.LocSet.filter (fun use -> Loc.contains use loc) all_uses in
Expand Down
14 changes: 4 additions & 10 deletions src/services/get_def/get_def_process_location.ml
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,7 @@ class virtual ['T] searcher _cx ~is_local_use ~is_legit_require ~covers_target ~
ignore
@@ this#request
(Get_def_request.Identifier
{
name = local_name;
loc = (this#loc_of_annot local_annot, this#type_from_enclosing_node local_annot);
}
{ name = local_name; loc = this#loc_of_annot local_annot }
);
spec

Expand Down Expand Up @@ -383,8 +380,7 @@ class virtual ['T] searcher _cx ~is_local_use ~is_legit_require ~covers_target ~

method! t_identifier ((loc, { Ast.Identifier.name; _ }) as id) =
if this#annot_covers_target loc then begin
let t = this#type_from_enclosing_node loc in
this#request (Get_def_request.Identifier { name; loc = (this#loc_of_annot loc, t) })
this#request (Get_def_request.Identifier { name; loc = this#loc_of_annot loc })
end;
super#t_identifier id

Expand Down Expand Up @@ -413,8 +409,7 @@ class virtual ['T] searcher _cx ~is_local_use ~is_legit_require ~covers_target ~
method! jsx_element_name_identifier ((annot, { Ast.JSX.Identifier.name; comments = _ }) as id) =
if this#annot_covers_target annot then begin
if name = String.capitalize_ascii name then
let annot = (this#loc_of_annot annot, this#type_from_enclosing_node annot) in
this#request (Get_def_request.Identifier { name; loc = annot })
this#request (Get_def_request.Identifier { name; loc = this#loc_of_annot annot })
else
this#found_empty "jsx intrinsic element"
end;
Expand All @@ -429,8 +424,7 @@ class virtual ['T] searcher _cx ~is_local_use ~is_legit_require ~covers_target ~
method! jsx_member_expression_identifier
((annot, { Ast.JSX.Identifier.name; comments = _ }) as id) =
if this#annot_covers_target annot then begin
let annot = (this#loc_of_annot annot, this#type_from_enclosing_node annot) in
this#request (Get_def_request.Identifier { name; loc = annot })
this#request (Get_def_request.Identifier { name; loc = this#loc_of_annot annot })
end;
super#jsx_member_expression_identifier id

Expand Down
2 changes: 1 addition & 1 deletion src/services/get_def/get_def_request.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type ('M, 'T) member_info = {
type ('M, 'T) t =
| Identifier of {
name: string;
loc: 'T;
loc: 'M;
}
| Type of {
annot: 'T;
Expand Down

0 comments on commit 10f17c1

Please sign in to comment.