Move get_super to utils

Reviewed By: martinoluca

Differential Revision: D3676620

fbshipit-source-id: 487e77e
master
Ryan Rhee 8 years ago committed by Facebook Github Bot 2
parent a9a38f20ec
commit 4a6202c772

@ -330,30 +330,11 @@ let checker_NSNotificationCenter _ decl_info impl_decl_info decls =
"removeObserver:name:object:") decls in
exists_method_calling_removeObserver || exists_method_calling_removeObserverName in
let get_super impl_decl_info =
let objc_interface_decl_current =
CFrontend_utils.Ast_utils.get_decl_opt_with_decl_ref
impl_decl_info.Clang_ast_t.oidi_class_interface in
let objc_interface_decl_super =
match objc_interface_decl_current with
| Some Clang_ast_t.ObjCInterfaceDecl(_, _, _, _, interface_decl_info) ->
CFrontend_utils.Ast_utils.get_decl_opt_with_decl_ref interface_decl_info.otdi_super
| _ -> None in
let objc_implementation_decl_super =
match objc_interface_decl_super with
| Some ObjCInterfaceDecl(_, _, _, _, interface_decl_info) ->
CFrontend_utils.Ast_utils.get_decl_opt_with_decl_ref
interface_decl_info.otdi_implementation
| _ -> None in
match objc_implementation_decl_super with
| Some ObjCImplementationDecl(_, _, decl_list, _, impl_decl_info) ->
Some (decl_list, impl_decl_info)
| _ -> None in
let rec exists_on_hierarchy f super =
match super with
| Some (decl_list, impl_decl_info) ->
f decl_list || exists_on_hierarchy f (get_super impl_decl_info)
(f decl_list
|| exists_on_hierarchy f (Ast_utils.get_super impl_decl_info))
| None -> false in
let eventually_removeObserver_in_whole_hierarchy decls impl_decl_info =

@ -469,6 +469,26 @@ struct
Buffer.add_string buffer name;
Buffer.contents buffer
let get_super impl_decl_info =
let objc_interface_decl_current =
get_decl_opt_with_decl_ref
impl_decl_info.Clang_ast_t.oidi_class_interface in
let objc_interface_decl_super =
match objc_interface_decl_current with
| Some Clang_ast_t.ObjCInterfaceDecl(_, _, _, _, interface_decl_info) ->
get_decl_opt_with_decl_ref interface_decl_info.otdi_super
| _ -> None in
let objc_implementation_decl_super =
match objc_interface_decl_super with
| Some ObjCInterfaceDecl(_, _, _, _, interface_decl_info) ->
get_decl_opt_with_decl_ref
interface_decl_info.otdi_implementation
| _ -> None in
match objc_implementation_decl_super with
| Some ObjCImplementationDecl(_, _, decl_list, _, impl_decl_info) ->
Some (decl_list, impl_decl_info)
| _ -> None
(*
let rec getter_attribute_opt attributes =
match attributes with
@ -486,6 +506,7 @@ struct
| `Setter setter -> setter.Clang_ast_t.dr_name
| _ -> (setter_attribute_opt rest)
*)
end
(* Global counter for anonymous block*)

@ -159,6 +159,15 @@ sig
(* Generates a key for a declaration based on its name and the declaration tag. *)
val generate_key_decl : Clang_ast_t.decl -> string
(*
* Given an objc impl decl info, return the super class's list of decls and
* its objc impl decl info.
*)
val get_super :
Clang_ast_t.obj_c_implementation_decl_info ->
(Clang_ast_t.decl list *
Clang_ast_t.obj_c_implementation_decl_info)
option
end

Loading…
Cancel
Save