Commit Graph

1315 Commits

Author SHA1 Message Date
cc8095d065 Add extends attributes for several types
Part of #670
2018-08-08 23:16:57 -04:00
42e02f7769 js-sys: Add extends attributes for js_sys::Number 2018-08-09 10:10:20 +09:00
505037ffae Merge pull request #669 from fitzgen/contributing-testing
Contributing testing docs
2018-08-08 19:50:00 -05:00
170f20e1fd futures: Add more documentation and example usage
Adds an example future that becomes ready on the next tick of the JavaScript
micro task queue.

Part of #614
2018-08-08 17:44:38 -07:00
235f9cc04e js-sys: Add extends attributes for js_sys::RegExp
Part of #670
2018-08-08 16:23:12 -07:00
e8a6341d2b test: Add documentation about configuring headless browser testing 2018-08-08 15:47:46 -07:00
66f10b0c72 Merge pull request #666 from fitzgen/instanceof-renamed-import-types
Instanceof renamed import types
2018-08-08 15:31:24 -07:00
2f455f1f7a macro-support: Run rustfmt on src/parser.rs 2018-08-08 14:42:53 -07:00
998d37a353 Use the JS name of an imported type for instanceof checks 2018-08-08 14:42:21 -07:00
153505f6c7 Document workaround for avoiding duplicated symbols when using wasm-bindgen-test from git 2018-08-08 20:28:49 +02:00
9104bf87e9 backend: Rename ast::ImportType::name to ast::ImportType::rust_name
This helps pave the way for adding a js_name, and makes it more clear which name
this is.
2018-08-07 16:09:38 -07:00
37db88ebfa Implement #[wasm_bindgen(extends = ...)]
This commit implements the `extends` attribute for `#[wasm_bindgen]` to
statically draw the inheritance hierarchy in the generated bindings, generating
appropriate `AsRef`, `AsMut`, and `From` implementations.
2018-08-07 13:04:11 -07:00
11553a1af2 Implement JsCast for all imported types
This commit implements the `JsCast` trait automatically for all imported types
in `#[wasm_bindgen] extern { ... }` blocks. The main change here was to generate
an `instanceof` shim for all imported types in case it's needed.

All imported types now also implement `AsRef<JsValue>` and `AsMut<JsValue>`
2018-08-07 12:59:51 -07:00
f3f11ed8eb Clean up generated code for imported types
Group all the generated impls in a `const` block so we can use `use` without
clashing with the outside scope.
2018-08-07 12:59:51 -07:00
0d18c8c397 Fix consuming a struct and returning a slice
This came up in a [recent comment][1] and it turns out we're accidentally
generating two `const ptr = ...` declarations, invalid JS! While Node doesn't
catch this it looks like firefox does.

[1]: https://github.com/rustwasm/wasm-bindgen/issues/329#issuecomment-411082013
2018-08-07 08:46:38 -07:00
b6a6dee7f1 Merge pull request #652 from afdw/master
Add support for getters, setters and deleters
2018-08-06 21:43:53 -05:00
86b5ba6431 Add missing indexing words 2018-08-07 02:45:08 +03:00
d396c168a5 Fix comments in parser 2018-08-07 00:48:03 +03:00
3ad5493d23 Add a test for webidl 2018-08-07 00:42:47 +03:00
e70c9015ff Rename special to indexing 2018-08-07 00:06:04 +03:00
ef3f086102 Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	crates/webidl/src/first_pass.rs
#	crates/webidl/src/lib.rs
#	crates/webidl/src/util.rs
2018-08-06 23:37:12 +03:00
b2977a4262 Delete wasm-bindgen-test-project-builder
No more tests use it!
2018-08-06 11:48:34 -07:00
d5b81595ec Remove support for the version attribute
First added in #161 this never ended up panning out, so let's remove the
experimental suport which isn't actually used by anything today and hold off on
any other changes until an RFC happens.
2018-08-06 13:30:28 -05:00
6edf063c94 Allow disabling --debug in wasm-bindgen-test-runner
Afterwards remove the `non_debug` test as we're running the entire test suite in
non-debug mode!
2018-08-06 09:57:41 -07:00
aeca24c7ab Add ArrayBuffer.prototype.byteLength to js-sys 2018-08-06 11:44:24 -05:00
0bdb31d41e Migrate the serde-serialize test to wasm 2018-08-06 09:43:55 -07:00
f96fcf78a1 Explicitly ignore some extended attributes
Cut down on generated warnings by explicitly ignoring attributes which it looks
like we don't need to handle at all.
2018-08-06 10:56:12 -05:00
72fff9c43e Ignore implements items explicitly
No need to warn about them because there's not much to handle with them anyway!
2018-08-06 10:56:12 -05:00
73e89fc59b Add bindings for RegExp.$1-$9 2018-08-06 10:41:06 -05:00
e35295d376 Migrate from the webidl crate to weedle
This commit migrates the `wasm-bindgen-webidl` crate from the `webidl` parser to
`weedle`. The main rationale for doing this is that `webidl` depends on
`lalrpop`, which is quite a large dependency and takes a good deal of time to
compile. The `weedle` crate, however, depends on `nom` and is much faster to
compile.

Almost all translations were pretty straightforward. Some abstractions changed
and/or were introduced in this commit when moving to `weedle` like the
`ToSynType` trait, but otherwise the generated bindings should be the same. It's
been verified that the `weedle`-generated bindings are exactly the same as the
`webidl`-generated bindings, with the one exception of `weedle` generates one
more method, `WebGpuCommandEncoder::transition_buffer`. It's not clear currently
why `webidl` didn't generate this method, as its [idl] is pretty straightforward!

This commit is using a [fork] of `weedle` currently which has a number of fixes
for parsing our WebIDL, although all the fixes are quite minor!

Closes #620

[idl]: d66b834afd/crates/web-sys/webidls/enabled/WebGPU.webidl (L499)
[fork]: https://github.com/alexcrichton/weedle/tree/fix-for-web-sys
2018-08-06 10:27:03 -05:00
21c36d3902 Allow js_name attribute to accept a string 2018-08-06 09:06:00 -05:00
fd2b2140a9 Add support for getters, setters and deleters 2018-08-05 23:32:51 +03:00
e9f9ede1fa Switch to openssl's vendored feature for musl builds
This should give us updates for free!
2018-08-05 10:40:08 -05:00
5b66045aff Add a test 2018-08-05 10:39:54 -05:00
ebab7d9fc8 Enable structural mode for all operations if there is a Global extended attribute on the interface 2018-08-05 10:39:54 -05:00
90579416cf Add WebIDL support for the object type
This maps to the `Object` type in the `js_sys` crate.
2018-08-05 01:04:28 -05:00
25a1bcb5be Fix tests on master 2018-08-04 15:16:02 -07:00
a98b5ea2a0 Add WebIDL support for the ArrayBuffer type
Should help enable a slew of new bindings as well.
2018-08-04 16:34:12 -05:00
5d4c135c31 Run Chrome headless tests on CI
Closes #622
2018-08-04 10:48:49 -05:00
da9203142f Add applying of typedefs, remove generation of type aliases 2018-08-04 14:04:24 +03:00
9c275d1f1d Use instantiateStreaming for --no-modules mode if possible 2018-08-03 22:34:59 -05:00
0624b0cf2e Add unit tests for even more 'web-sys' bindings
That list includes:
 * HtmlMenuElement
 * HtmlMenuItemElement
 * HtmlMetaElement
 * HtmlMeterElement
2018-08-03 17:41:38 -05:00
07b4ef5838 Add support for empty enum variants and enum variants that start with a digit 2018-08-03 17:41:24 -05:00
afaf94a428 Add support for optional chars 2018-08-03 15:59:27 -05:00
4a0c69ffed Add support for optional bools 2018-08-03 15:59:27 -05:00
0ef528165f Rename functions, remove escaped newlines 2018-08-03 15:59:27 -05:00
2249032ba8 Revert WebIDLs with optional enum types, they are still not implemented 2018-08-03 15:59:27 -05:00
c49c18826d Add support for optional numbers 2018-08-03 15:59:27 -05:00
2a6d98a6c9 Remove usage of syn's visit-mut feature (#631)
Looks like we're the only one in the dependency graph enabling this, so let's
try to cut down on compile times by not requiring it.
2018-08-03 14:11:44 -05:00
3d3bf5dc83 add test for HTMLTableElement in web-sys crate (#629) 2018-08-03 09:02:31 -05:00