nst / RuntimeBrowser

Objective-C Runtime Browser, for Mac OS X and iOS
3.55k stars 510 forks source link

Type Parser additions and fixes #37

Closed leptos-null closed 4 years ago

leptos-null commented 5 years ago

Adds support for the byref, _Atomic, and _Complex type specifiers to the type decoder (version 1)

leptos-null commented 5 years ago

Second commit is also for type decoder (version 1) and fixes a bug where the ivT pointer would get incremented in the id (@) parse subroutine no matter if the second character indicating the encoding represented a block was present or not

leptos-null commented 5 years ago

I just happened to look at 9d4eb19816212bc3547ab68dfa06d7ddeb4c5b4d, and realized something had gone wrong, because f7a7f91abf6eab82c1217e214f59303d1bbaba6d undid it.

BOOL isBlock = *ivT == '?';
if(isBlock && [[NSUserDefaults standardUserDefaults] boolForKey:@"RTBAddCommentsForBlocks"]) {
    // first increment was here (0), and it moved back here (2)
    typeS = (spaceAfter ? @"id /* block */ " : @"id /* block */");
} else {
    typeS = (spaceAfter ? @"id " : @"id");
}
// then it was here (1)

The problem is that the logic gate has two components: isBlock and we'll call [[NSUserDefaults standardUserDefaults] boolForKey:@"RTBAddCommentsForBlocks"] shouldAddComments. The way that typeS should be set is the same for !isBlock || !shouldAddComments, so that logic makes sense. In contrast, ivT should only be incremented if isBlock, which there wasn't a branch for.

nst commented 4 years ago

Sorry for the long delay to merge, and thank you for your valuable contribution!