Commit Graph

1104 Commits

Author SHA1 Message Date
61fc8d2567 Js sys once over (#550)
* js-sys: Return `f64` instead of `Number`

* js-sys: remove trailing whitespace

* js-sys: Ensure that all imported types derive Clone and Debug

* js-sys: Imported functions should always take JS object arguments by-ref
2018-07-25 16:33:44 -05:00
dbb498174e Merge pull request #547 from derekdreery/extra_docs
Extra docs
2018-07-25 12:04:29 -07:00
66bc98cc4b Fix mistakes/nits. 2018-07-25 18:08:57 +01:00
3f5a0fb31c Bump to 0.2.14 2018-07-25 09:46:45 -07:00
c8f0304163 Fix LLVM ERROR
fixes #545
2018-07-25 07:24:39 -04:00
ba67089501 Some docs for functions in the parsing/codegen crates. 2018-07-25 11:42:01 +01:00
2ee80a6c44 Add some docs 2018-07-24 17:37:49 +01:00
4b4bed5ce2 Initial support for Document, EventTarget, NodeList and Iterator (#541)
* Adding document and node support

* Initial support for Document, EventTarget, NodeList and Iterator

* Add in support for output option type
2018-07-24 09:00:46 -05:00
cefe1681ab Implement Math.min() and Math.max() bindings (#542)
* Add Number.isNaN() binding

* Add binding for Math.hypot()

* Implement Math.min() and Math.max() bindings
2018-07-23 23:50:29 -05:00
b3ee71c20b WebIDL: Handle Invalid Enum Returns (#477)
* move ImportEnum attributes to a property

* borrow from_js_value argument

* make WebIDL enums non-exhaustive

* add more tests for WebIDL enums
2018-07-23 10:04:28 -05:00
5fddcf3868 Add Math.hypot binding (#538)
* Add Number.isNaN() binding

* Add binding for Math.hypot()
2018-07-23 09:11:03 -05:00
de0ba29abc implements bindings for Object.is (#537)
* implements bindings for Object.is

* adds counterpart test cases for non-equal values
2018-07-22 12:42:10 -05:00
82c2dfa7b2 Bump to 0.2.13 (#536) 2018-07-21 23:10:47 -05:00
6679ddfefc Move final js-sys test to a headless suite
Hopefully this doesn't need to get too large over time!
2018-07-21 20:09:45 -07:00
59c04e26d4 Port Reflect tests to wasm 2018-07-21 20:07:55 -07:00
906cd7adcc Remove usage of wasm_import_module feature
This is now stabilized! Also tweak usage of it to the stable version.
2018-07-21 19:00:40 -07:00
2ef4b74ca6 add unescape 2018-07-21 23:06:36 +02:00
b7acb0785d Add Number.isNaN() binding (#532) 2018-07-21 15:19:30 -05:00
2da77fb8b0 Merge the cli and test-runner packages
Shouldn't be any need to have them versioned separately!
2018-07-20 22:42:36 -07:00
2e5cc810c8 Migrate tests for global functions to wasm 2018-07-20 17:45:00 -07:00
5f87ed4cef Port WebAssembly tests to wasm 2018-07-20 17:09:50 -07:00
9f7eea1e75 Port WeakSet tests to wasm 2018-07-20 17:07:00 -07:00
1d1df09e60 Port WeakMap tests to wasm 2018-07-20 17:01:26 -07:00
b667cafb63 Port TypedArray tests to wasm 2018-07-20 16:31:29 -07:00
df3530a9c2 Port Symbol and SetIterator tests to wasm 2018-07-20 16:19:10 -07:00
54abca7344 Port Set tests to wasm 2018-07-20 15:44:15 -07:00
ad86c52b02 Port Proxy tests to wasm 2018-07-20 15:35:15 -07:00
01ff04d85c Port Object tests to wasm 2018-07-20 15:23:56 -07:00
fb6041cf3b Port Number tests to wasm 2018-07-20 14:35:44 -07:00
627ddcb192 Port Math tests to wasm 2018-07-20 14:21:29 -07:00
230f923fdb Port MapIterator tests to wasm 2018-07-20 13:57:18 -07:00
2c9a606c3d Port Map tests to wasm 2018-07-20 13:46:22 -07:00
f3e34d854d Port JsString tests to wasm 2018-07-20 13:35:46 -07:00
d76f619298 Port Intl tests to wasm 2018-07-20 13:00:44 -07:00
067de51e57 Port Generator tests to wasm 2018-07-20 12:56:32 -07:00
f3d4a20ec7 Change Function::apply to catch the result
We don't know whether it'll throw or not!
2018-07-20 12:44:21 -07:00
75215134a5 Migrate Function tests to wasm 2018-07-20 12:43:07 -07:00
347c1daad9 Tweak instructions in js-sys/src/lib.rs 2018-07-20 12:27:03 -07:00
20e9267775 Port Error tests to wasm 2018-07-20 12:21:41 -07:00
cc8e7edd83 Revert "Explicitly ignore "Exposed" attributes"
This reverts commit 81150492a5.
2018-07-20 12:15:25 -07:00
601b138296 Port Date tests to wasm 2018-07-20 12:07:41 -07:00
81150492a5 Explicitly ignore "Exposed" attributes
It looks like these are primarily targeted at informing whether functionality is
either on web workers, windows, or both. For now we'll generate the same
bindings regardless, and users will need to be proactive about what they're
using. In that case there shouldn't be any need for us to process these, so
avoid warning about them!
2018-07-20 12:07:39 -07:00
efd6b2abac Migrate Array tests to wasm-bindgen-test 2018-07-20 11:48:57 -07:00
f8d336d711 Add a test harness to directly execute wasm tests (#524)
* Add a test harness to directly execute wasm tests

This commits adds a few new crates and infrastructure to enable comands like:

    cargo test --target wasm32-unknown-unknown

The intention here is to make it as low-friction as possible to write wasm tests
and also have them execute in a reasonable amount of time. Eventually this is
also hopefully enough support to do things like headless testing!

For now though this is defintely MVP status rather than fully fleshed out.
There's some more information at `crates/test/README.md` about how it works and
how to use it, but for now this is mainly intended to play around with locally
in this repository for our own tests.

* Port a numbe of `js-sys` tests to the new test framework

This commit ports a number of existing tests for the `js-sys` crate over to the
new test framework created in the previous commit, showing off how they can be
executed as well as drastictlly simplifying the tests themselves! This is
intended to be a proof of concept for now which we can refine over time. This
should also show off that it's possible to incrementally move over to the new
test framework.
2018-07-20 13:47:49 -05:00
9753f9150b Allow renaming exported functions into JS (#525)
Support the `js_name` attribute on exports as well as imports to allow exporting
types as camelCase instead of snake_case, for example.

Closes #221
2018-07-20 12:01:28 -05:00
ff1eb345e0 Link to docs in README. (#522) 2018-07-20 10:41:07 -05:00
bec1c95b5c bindings for to_locale_XXX_case (#523) 2018-07-20 09:03:29 -05:00
2d70a51370 Publication cleanup 2018-07-19 13:03:52 -07:00
aa348f963f Bump to 0.2.12 (#515)
* Bump to 0.2.12

* Update all version numbers and deps
* Update all listed authors to `["The wasm-bindgen Developers"]`
* Update `repository` links to specific paths for each crate
* Update `homepage` links to the online book
* Update all links away from `alexcrichton/wasm-bindgen`
* Add `#[doc]` directives for HTML URLs

* Update more version requirements

* Fill out CHANGELOG
2018-07-19 14:57:04 -05:00
cbeb301371 Add support for optional slice types (#507)
* Shard the `convert.rs` module into sub-modules

Hopefully this'll make the organization a little nicer over time!

* Start adding support for optional types

This commit starts adding support for optional types to wasm-bindgen as
arguments/return values to functions. The strategy here is to add two new
traits, `OptionIntoWasmAbi` and `OptionFromWasmAbi`. These two traits are used
as a blanket impl to implement `IntoWasmAbi` and `FromWasmAbi` for `Option<T>`.

Some consequences of this design:

* It should be possible to ensure `Option<SomeForeignType>` implements to/from
  wasm traits. This is because the option-based traits can be implemented for
  foreign types.
* A specialized implementation is possible for all types, so there's no need for
  `Option<T>` to introduce unnecessary overhead.
* Two new traits is a bit unforutnate but I can't currently think of an
  alternative design that works for the above two constraints, although it
  doesn't mean one doesn't exist!
* The error messages for "can't use this type here" is actually halfway decent
  because it says these new traits need to be implemented, which provides a good
  place to document and talk about what's going on here!
* Nested references like `Option<&T>` can't implement `FromWasmAbi`. This means
  that you can't define a function in Rust which takes `Option<&str>`. It may be
  possible to do this one day but it'll likely require more trait trickery than
  I'm capable of right now.

* Add support for optional slices

This commit adds support for optional slice types, things like strings and
arrays. The null representation of these has a pointer value of 0, which should
never happen in normal Rust. Otherwise the various plumbing is done throughout
the tooling to enable these types in all locations.

* Fix `takeObject` on global sentinels

These don't have a reference count as they're always expected to work, so avoid
actually dropping a reference on them.

* Remove some no longer needed bindings

* Add support for optional anyref types

This commit adds support for optional imported class types. Each type imported
with `#[wasm_bindgen]` automatically implements the relevant traits and now
supports `Option<Foo>` in various argument/return positions.

* Fix building without the `std` feature

* Actually fix the build...

* Add support for optional types to WebIDL

Closes #502
2018-07-19 14:44:23 -05:00