Skip to content

Conversation

@ptitjes
Copy link

@ptitjes ptitjes commented Feb 6, 2021

This commit add support for creating vectors directly from in-memory JavaScript typed arrays (Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array and Float64Array).

There was already support for reading directly to typed arrays. This brings the counterpart for writing.

This commit also removes the invalid Uint8Array overloads. These overloads were invalid as they enabled a TypeScript user to pass a Uint8Array to the generated methods which were in turn iterating on the array content as if they were normal numbers.

Summary of changes:

  • add support for typed array factory methods in builder.ts
  • add corresponding support in idl_gen_ts.cpp
  • remove invalid Uint8Array overloads in idl_gen_ts.cpp

This PR is based on #6445 which fixed a code gen bug after #6420.

This commit add support for creating vectors directly from in-memory
JavaScript typed arrays (Int8Array, Uint8Array, Int16Array, Uint16Array,
Int32Array, Uint32Array, Float32Array and Float64Array).

There was already support for reading directly to typed arrays. This
brings the counterpart for writing.

This commit also removes the invalid Uint8Array overloads. These
overloads were invalid as they enabled a TypeScript user to pass a
Uint8Array to the generated methods which were in turn iterating on
the array content as if they were normal numbers.

Summary of changes:
* add support for typed array factory methods in builder.ts
* add corresponding support in idl_gen_ts.cpp
* remove invalid Uint8Array overloads in idl_gen_ts.cpp
@github-actions github-actions bot added c++ codegen Involving generating code from schema javascript typescript labels Feb 6, 2021
@ptitjes
Copy link
Author

ptitjes commented Feb 6, 2021

@krojew Would you mind helping me make my two PRs pass the CIs ? I think the problems come from the generated files.

@aardappel
Copy link
Collaborator

@bjornharrtell

@bjornharrtell
Copy link
Collaborator

bjornharrtell commented Feb 10, 2021

This seems like a really nice addition!

I think it's the SwiftFormat complaining that the code (c++) is not fully up to the guidelines. I see this error at CI:

image

@krojew
Copy link
Contributor

krojew commented Feb 10, 2021

Sorry for not responding, but I have almost no free time at the moment.

@github-actions
Copy link
Contributor

This pull request is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Aug 11, 2021
@ptitjes
Copy link
Author

ptitjes commented Aug 12, 2021

I will update this PR soon.

@github-actions github-actions bot removed the stale label Aug 12, 2021
@dbaileychess
Copy link
Collaborator

@ptitjes Any plans to continue this? Otherwise I will mark it closed.

@dbaileychess
Copy link
Collaborator

Please reopen if you would like to continue this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema javascript typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants