[dart2wasm] Simplify bool return types in two imports

JS bool type can be returned as `i32`, which avoids boxing.

Change-Id: I491b1da58a740bd992099fc6ee40eca1f38811c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341481
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Ömer Sinan Ağacan 2023-12-13 13:12:20 +00:00 committed by Commit Queue
parent 321c113fa0
commit d794b26a6a

View file

@ -45,10 +45,10 @@ extension NullableUndefineableJSAnyExtension on JSAny? {
"this API should not be used when compiling to Wasm.");
@patch
bool typeofEquals(String type) =>
_box<JSBoolean>(js_helper.JS<WasmExternRef?>('(o, t) => typeof o === t',
this.toExternRef, type.toJS.toExternRef))
.toDart;
bool typeofEquals(String type) => js_helper
.JS<WasmI32>(
'(o, t) => typeof o === t', this.toExternRef, type.toJS.toExternRef)
.toBool();
@patch
Object? dartify() => js_util.dartify(this);
@ -65,10 +65,10 @@ extension NullableObjectUtilExtension on Object? {
@patch
extension JSObjectUtilExtension on JSObject {
@patch
bool instanceof(JSFunction constructor) =>
_box<JSBoolean>(js_helper.JS<WasmExternRef?>(
'(o, c) => o instanceof c', toExternRef, constructor.toExternRef))
.toDart;
bool instanceof(JSFunction constructor) => js_helper
.JS<WasmI32>(
'(o, c) => o instanceof c', toExternRef, constructor.toExternRef)
.toBool();
}
/// [JSExportedDartFunction] <-> [Function]