[linters] Add extra case of respondsToSelector block

Reviewed By: martinoluca

Differential Revision: D4528659

fbshipit-source-id: face498
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent ae03acb71b
commit dbcb871988

@ -46,6 +46,7 @@ let rec get_responds_to_selector stmt =
let open Clang_ast_t in let open Clang_ast_t in
match stmt with match stmt with
| ObjCMessageExpr (_, [_; ObjCSelectorExpr (_, _, _, method_name)], _, mdi) | ObjCMessageExpr (_, [_; ObjCSelectorExpr (_, _, _, method_name)], _, mdi)
| ObjCMessageExpr (_, [ObjCSelectorExpr (_, _, _, method_name)], _, mdi)
when String.equal mdi.Clang_ast_t.omei_selector "respondsToSelector:" -> when String.equal mdi.Clang_ast_t.omei_selector "respondsToSelector:" ->
[method_name] [method_name]
| BinaryOperator (_, [stmt1;stmt2], _, bo_info) | BinaryOperator (_, [stmt1;stmt2], _, bo_info)

@ -73,4 +73,17 @@
} }
} }
// no bug
- (void)uifont_with_respondstoselector:(CGFloat)size {
UIFont* font;
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) {
font = [UIFont systemFontOfSize:size weight:0];
}
}
// bug
- (void)uifont_without_respondstoselector:(CGFloat)size {
UIFont* font = [UIFont systemFontOfSize:size weight:0];
}
@end @end

@ -1,3 +1,4 @@
codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_uifont_without_respondstoselector:, 86, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_with_responds_to_selector_in_else:, 52, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_with_responds_to_selector_in_else:, 52, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector:, 45, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] codetoanalyze/objc/ioslinters/unavailable_api_allowed_cases.m, Unavailable_api_allowed_cases_without_responds_to_selector:, 45, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []
codetoanalyze/objc/ioslinters/unavailable_api_in_supported_ios_sdk.m, OpenURLOptionsFromSourceApplication, 18, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, [] codetoanalyze/objc/ioslinters/unavailable_api_in_supported_ios_sdk.m, OpenURLOptionsFromSourceApplication, 18, UNAVAILABLE_API_IN_SUPPORTED_IOS_SDK, []

Loading…
Cancel
Save