Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Test/BlockImpTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ int main(void)
struct big b = {1, 2, 3, 4, 5};
return b;
};
blk = Block_copy((blk));
imp = imp_implementationWithBlock(blk);
assert(imp && "Can't make sret IMP");
// imp_getBlock / imp_removeBlock must also work for struct-return blocks.
assert(imp_getBlock(imp) == blk);
type = block_copyIMPTypeEncoding_np(blk);
assert(NULL != type);
class_addMethod((objc_getMetaClass("Foo")), @selector(sret), imp, type);
Expand All @@ -62,5 +65,7 @@ int main(void)
assert(s.c == 3);
assert(s.d == 4);
assert(s.e == 5);
imp_removeBlock(imp);
assert(imp_getBlock(imp) != blk);
return 0;
}
4 changes: 2 additions & 2 deletions block_to_imp.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ id imp_getBlock(IMP anImp)
if (idx == -1)
{
set = sret_trampolines;
indexForIMP(anImp, &set);
idx = indexForIMP(anImp, &set);
}
if (idx == -1)
{
Expand All @@ -390,7 +390,7 @@ BOOL imp_removeBlock(IMP anImp)
if (idx == -1)
{
set = sret_trampolines;
indexForIMP(anImp, &set);
idx = indexForIMP(anImp, &set);
}
if (idx == -1)
{
Expand Down
Loading