[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:
John Doty 2023-08-19 07:38:15 -07:00
parent 0cb5944d0a
commit 6200ed31b6
5 changed files with 82 additions and 31 deletions

View file

@ -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.