Store richer adapter types, don't use instructions for TypeScript #1945
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit updates how TypeScript signature are generated from adapters
in wasm-bindgen. A richer set of
AdapterType
types are now storedwhich record information about optional types and such. These direct
AdapterType
values are then used to calculate the TypeScriptsignature, rather than following the instructions in an adapter function
(which only works anyway for wasm-bindgen generated adapters).
This should be more robust since it reads the actual true signature of
the adapter to generate the TypeScript signature, rather than attempting
to ad-hoc-ly infer it from the various instructions, which was already
broken.
A number of refactorings were involved here, but the main pieces are:
AdapterType
type is a bit more rich now to describe moreRust-like types.
TypescriptArg
structure is now gone and instead return valuesare directly inferred from type signatures of adapters.
typescript_{required,optional}
methods are no longer needed.JsBuilder::process
was enhanced to return more values,rather than storing some return values on the structure itself.
Closes #1926