[dart2wasm] Fix dartify check for WasmGC struct.

Change-Id: I86a31a542ddd5b8a85249b80d9ad9235561b3ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260000
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This commit is contained in:
Joshua Litt 2022-09-22 17:40:38 +00:00 committed by Commit Bot
parent b8eede8c9f
commit eb17780ef1

View file

@ -375,6 +375,8 @@ WasmExternRef? jsifyRaw(Object? object) {
}
}
bool isWasmGCStruct(WasmExternRef ref) => ref.internalize().isObject;
/// TODO(joshualitt): We shouldn't need this, but otherwise we seem to get a
/// cast error for certain oddball types(I think undefined, but need to dig
/// deeper).
@ -419,15 +421,10 @@ Object? dartifyRaw(WasmExternRef? ref) {
return toDartList(ref);
} else if (isJSWrappedDartFunction(ref)) {
return unwrapJSWrappedDartFunction(ref);
} else if (isJSObject(ref) ||
// TODO(joshualitt): We may want to create proxy types for some of these
// cases.
isJSBigInt(ref) ||
isJSSymbol(ref) ||
isJSFunction(ref)) {
return JSValue(ref);
} else {
} else if (isWasmGCStruct(ref)) {
return jsObjectToDartObject(ref);
} else {
return JSValue(ref);
}
}