Skip to content

toJS conversions of Dart typed lists create a new typed array even if typed list was a wrapper from toDart #61543

@srujzs

Description

@srujzs

On dart2wasm, when toJS is called, we check if the typed list was a wrapper. If so, we call toJSArrayExternRef:

. Otherwise, we clone:
WasmExternRef jsFloat32ArrayFromDartFloat32List(Float32List l) {
.

However, toJSArrayExternRef creates a new typed array using the existing buffer:

.

This then leads to equality check failures between a and a.toDart.toJS. For that reason and consistency with how we handle List/JSArray conversions, we should return the original typed array. This also makes the a.toDart.toJS consistent with the JS compilers.

Metadata

Metadata

Assignees

Labels

area-dart2wasmIssues for the dart2wasm compiler.area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions