Skip to content

Commit

Permalink
fix char → Boolean conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskollmer committed Jan 21, 2022
1 parent 27300f9 commit bf2566f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ class Instance {

if (returnTypeEncoding === '@') {
return InstanceProxy(new Instance(retval)); // eslint-disable-line new-cap
} else if (returnTypeEncoding === 'c') {
// TODO This means that we can't return chars, which is bad. Find a solution to support both!
} else if (returnTypeEncoding === 'B') {
// This won't catch all booleans, since on x86_64 bools are encoded as 'c'
// (which we can't just flat-out all convert to Booleans),
// but C/C++ bools and ObjC BOOLs on ARM are encoded as 'B', so we should handle at least these properly...
return Boolean(retval);
}
return retval;
Expand Down

0 comments on commit bf2566f

Please sign in to comment.