[oden-js] Fix cross-platform conversions
Lots of places were assuming that bool and c int were interchangeable, but of course on windows a c int is 32 bits and that confused everybody. Tighten up the definitions in static-functions, which causes us to fix boolean conversion. Also add tests for boolean conversion, and also add better debug formatting of JS values.
This commit is contained in:
parent
0cb5944d0a
commit
6200ed31b6
5 changed files with 82 additions and 31 deletions
|
|
@ -182,7 +182,8 @@ impl ContextRef {
|
|||
where
|
||||
T: Into<bool>,
|
||||
{
|
||||
self.check_exception(unsafe { sys::JS_NewBool(self.ctx, value.into()) })
|
||||
let b = if value.into() { 1 } else { 0 };
|
||||
self.check_exception(unsafe { sys::JS_NewBool(self.ctx, b) })
|
||||
}
|
||||
|
||||
/// Construct a new value that wraps a strongly-typed closure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue