This commit updates how TypeScript signature are generated from adapters
in wasm-bindgen. A richer set of `AdapterType` types are now stored
which record information about optional types and such. These direct
`AdapterType` values are then used to calculate the TypeScript
signature, 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:
* The `AdapterType` type is a bit more rich now to describe more
Rust-like types.
* The `TypescriptArg` structure is now gone and instead return values
are directly inferred from type signatures of adapters.
* The `typescript_{required,optional}` methods are no longer needed.
* The return of `JsBuilder::process` was enhanced to return more values,
rather than storing some return values on the structure itself.
Closes#1926
There are functions that are only used on wasm32 targets, but `cfg`ing them is
more work than just making the modules public, and this is just a testing crate.
Most of the CLI crates were already in the 2018 edition, and it turns
out that one of the macro crates was already in the 2018 edition so we
may as well move everything to the 2018 edition!
Always nice to remove those `extern crate` statements nowadays!
This commit also does a `cargo fmt --all` to make sure we're conforming
with style again.
This commit starts to add some simple tests for our TypeScript output of
the wasm-bindgen CLI, currently just running `tsc` to make sure syntax
looks good and types are emitted as expected. This'll hopefully be able
to get expanded over time with bug reports as they come in as well as
ensure that we don't regress anything in egregious manners!
Closes#922