[linters] Improve the to_string method for string constants

Reviewed By: martinoluca

Differential Revision: D5536440

fbshipit-source-id: 0f759d8
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent a292620a69
commit d0858c7770

@ -69,6 +69,10 @@ let rec ast_node_name an =
match decl_ref.dr_name with Some name -> name.ni_name | None -> ""
in
ast_node_name (Stmt stmt) ^ "." ^ property_str
| Stmt StringLiteral (_, _, _, s)
-> s
| Stmt ObjCStringLiteral (_, [stmt], _)
-> "@" ^ ast_node_name (Stmt stmt)
| _
-> ""

@ -51,4 +51,15 @@ extern NSString* const key;
func_with_integer_param(self.p);
}
typedef NS_ENUM(NSUInteger, MyEnum) {
MyEnumItem,
};
- (void)enum_param:(MyEnum)s {
}
- (void)call_with_string {
[self enum_param:@"s"];
}
@end

@ -23,6 +23,7 @@ codetoanalyze/objc/linters/badpointer.m, bad6, 106, BAD_POINTER_COMPARISON, []
codetoanalyze/objc/linters/badpointer.m, bad7, 121, BAD_POINTER_COMPARISON, []
codetoanalyze/objc/linters/badpointer.m, bad8, 128, BAD_POINTER_COMPARISON, []
codetoanalyze/objc/linters/badpointer.m, bad9, 135, BAD_POINTER_COMPARISON, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_call_with_string, 62, POINTER_TO_INTEGRAL_IMPLICIT_CAST, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_ivar_dictionary_item_call_funct_with_int, 47, POINTER_TO_INTEGRAL_IMPLICIT_CAST, []
codetoanalyze/objc/linters/implicit_cast.m, Implicit_cast_property_with_int, 51, POINTER_TO_INTEGRAL_IMPLICIT_CAST, []
codetoanalyze/objc/linters/implicit_cast.m, calling_funct_with_pointer, 17, POINTER_TO_INTEGRAL_IMPLICIT_CAST, []

Loading…
Cancel
Save