Don't convert boolean arguments going to wasm

The wasm spec defines boolean conversion when crossing to the wasm type
i32 as 1 for `true` and 0 for `false`, so no need for us to do it
ourselves!
This commit is contained in:
Alex Crichton 2018-11-08 13:06:03 -08:00
parent a16b4dd9a4
commit 6093fd29d1
2 changed files with 2 additions and 2 deletions

View File

@ -401,7 +401,7 @@ impl<'a, 'b> Js2Rust<'a, 'b> {
name = name
));
}
self.rust_arguments.push(format!("{} ? 1 : 0", name));
self.rust_arguments.push(format!("{}", name));
}
Descriptor::Char => {
self.js_arguments.push((name.clone(), "string".to_string()));

View File

@ -489,7 +489,7 @@ impl<'a, 'b> Rust2Js<'a, 'b> {
}
self.ret_expr = match *ty {
Descriptor::Boolean => "return JS ? 1 : 0;".to_string(),
Descriptor::Boolean => "return JS;".to_string(),
Descriptor::Char => "return JS.codePointAt(0);".to_string(),
_ => bail!(
"unsupported return type for calling JS function from Rust: {:?}",