Commit Graph

1559 Commits

Author SHA1 Message Date
b9dc937d73 Refactor WebIDL code generation
This commit refactors WebIDL code generation to walk over the fields of
`FirstPassRecord` instead of walking the AST again. This helps remove
redundancies like checking `is_chrome_only` as well as revisiting partial
interfaces and such. This should make it more clear that the first pass's job is
to walk the AST and collect all relevant information, while the codegen pass is
purely about appending items to a `Program`.

Additionally this refactoring will also soon be used to prepare different data
structures for operation overloadings, avoiding the need to walk those ASTs
twice.
2018-08-30 12:54:54 -07:00
d358fa0987 Merge pull request #766 from alexcrichton/remove-uint8-clamped-array
webidl: Remove support for Uint8ClampedArray
2018-08-30 12:53:37 -07:00
e25feccc11 webidl: Remove support for Uint8ClampedArray
Our bindings currently translate this to `&[u8]` which is actually `Uint8Array`.
We'll need to fix #421 before supporting this.
2018-08-30 10:34:50 -07:00
df19b63c60 Hack around a broken nightly 2018-08-30 10:33:45 -07:00
5319c1c31d Merge pull request #764 from fitzgen/readme-features
README: add features section describing goals/foundations/features of…
2018-08-29 15:23:15 -07:00
96573574c1 README: add features section describing goals/foundations/features of wasm-bindgen 2018-08-29 14:24:09 -07:00
1565459107 Merge pull request #761 from alexcrichton/more-globals
web-sys: Add support for `Global`-scope methods
2018-08-28 18:36:53 -07:00
4a9a2af2fc Merge pull request #762 from alexcrichton/no-nightly
Don't enable `nightly` feature of `proc-macro2`
2018-08-28 18:36:42 -07:00
0fb31b2bc4 Don't enable nightly feature of proc-macro2
This is no longer needed as of rustc 1.30.0 and the `proc-macro2` crate will now
automatically detect whether it can use spans or not!
2018-08-28 17:24:43 -07:00
36b854b69c web-sys: Add support for Global-scope methods
This commit adds further support for the `Global` attribute to not only emit
structural accessors but also emit functions that don't take `&self`. All
methods on a `[Global]` interface will not require `&self` and will call
functions and/or access properties on the global scope.

This should enable things like:

    Window::location() // returns `Location`
    Window::fetch(...) // invokes the `fetch` function

Closes #659
2018-08-28 17:20:31 -07:00
447b42b7ac Merge pull request #759 from alexcrichton/shared-memory-strings
Fix `getStringFromWasm` for shared memory
2018-08-28 12:16:52 -07:00
5ed7b806d1 Fix getStringFromWasm for shared memory
We currently pass a raw view into wasm's memory for `getStringFromWasm`, but if
the memory is actually shared then `TextDecoder` rejects `SharedArrayBuffer` and
won't actually decode anything. Work around this for now with an extra copy into
a local buffer, and then pass that buffer to `getStringFromWasm` whenever memory
is shared.
2018-08-28 10:58:26 -07:00
4b15570b3f Merge pull request #758 from alexcrichton/bump-parity-wasm
Bump dependency on parity-wasm to 0.32.0
2018-08-28 10:54:42 -07:00
f7e6fa2a04 Bump dependency on parity-wasm to 0.32.0
Brings support for atomic instructions!
2018-08-28 10:12:56 -07:00
a48a35fe41 Fix npm ci on AppVeyor 2018-08-27 19:02:26 -07:00
0e38388e7b Remove package-lock.json
It shouldn't be critical now that we're no longer testing with it and the
examples build should be testing against the latest anyway!
2018-08-27 17:40:46 -07:00
7154372af9 Remove yarn tests on CI
We're not actually using them any more!
2018-08-27 17:39:40 -07:00
6c0a00ca39 Build tags on AppVeyor 2018-08-27 17:34:35 -07:00
b41ce52d98 Merge pull request #756 from fitzgen/mdn-links
js-sys: Make MDN URLs into links
2018-08-27 17:21:27 -07:00
26c351ecf4 js-sys: Make MDN URLs into links 2018-08-27 15:18:48 -07:00
69a831423b Update publishing instructions
We've got a publish script now!
2018-08-27 13:51:47 -07:00
4863ccd100 Update CHANGELOG for 0.2.19 2018-08-27 13:49:34 -07:00
d9bc0a3176 Bump to 0.2.19 0.2.19 2018-08-27 13:39:23 -07:00
c89182b1fd Merge remote-tracking branch 'origin/master' into bump 2018-08-27 13:38:53 -07:00
98008b9e77 Bump to 0.2.18
At the same time, also add a `publish.rs` script to ease our publishing woes.
0.2.18
2018-08-27 13:37:55 -07:00
502311f3a9 Merge pull request #755 from alexcrichton/memory-accessor
Add an accessor for wasm's own memory as a JS object
2018-08-27 13:04:03 -07:00
e1474110d4 Add an accessor for wasm's own memory as a JS object
In addition to closing #495 this'll be useful eventually when instantiating
multiple wasm modules from Rust as you'd now be able to acquire a reference to
the current module in Rust itself.
2018-08-27 11:05:55 -07:00
85fd49f90a Fix importing same types in two modules/crates
This'll hopefully fix fallout from 4f4da747ad
2018-08-27 09:59:47 -07:00
0f787e42f8 Merge pull request #754 from rustwasm/dependabot/npm_and_yarn/webpack-dev-server-3.1.6
Bump webpack-dev-server from 3.1.5 to 3.1.6
2018-08-27 09:18:28 -07:00
9225642eaa Bump webpack-dev-server from 3.1.5 to 3.1.6
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.1.5...v3.1.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-27 08:13:19 +00:00
9fc43f8a19 Merge pull request #752 from alexcrichton/remove-hack
Remove a hack around an LLVM bug
2018-08-26 15:43:07 -07:00
856892d11d Merge pull request #750 from alexcrichton/import-memory
Add support for modules importing memory
2018-08-26 15:42:24 -07:00
335c0b1ab6 Add support for modules importing memory
The default of Rust wasm binaries is to export the memory that they contain, but
LLD also supports an `--import-memory` option where memory is imported into a
module instead. It's looking like importing memory is along the lines of how
shared memory wasm modules will work (they'll all import the same memory).

This commit adds support to wasm-bindgen to support modules which import memory.
Memory accessors are tweaked to no longer always assume that the wasm module
exports its memory. Additionally JS bindings will create a `memory` option
automatically because LLD always imports memory from an `env` module which won't
actually exist.
2018-08-26 15:41:36 -07:00
0cd04ca85e Merge pull request #749 from alexcrichton/wasm-memory
Add WebAssembly.Memory to js-sys
2018-08-26 15:40:58 -07:00
bb7ca348c2 Add WebAssembly.Memory to js-sys
This adds definitions for the `WebAssembly.Memory` type to `js-sys`.
2018-08-26 15:40:37 -07:00
4f4da747ad Remove a hack around an LLVM bug
This has since been fixed in rust-lang/rust#52506
2018-08-25 10:45:51 -07:00
2f8d437684 Merge pull request #748 from alexcrichton/no-mut
Remove casting to `&mut T` for JS casts
2018-08-25 10:03:17 -07:00
9729efe50e Remove casting to &mut T for JS casts
I discussed this with @fitzgen awhile back and this sort of casting seems
especially problematic when you have code along the lines of:

    let mut x: HtmlElement = ...;
    {
        let y: &mut JsValue = x.as_ref();
        *y = 3.into();
    }
    x.some_html_element_method();

as that will immediately throw! We didn't have a use case for mutable casting
other than consistency, so this commit removes it for now. We can possibly add
it back in later if motivated, but for now it seems reasonable to try to avoid
these sorts of pitfalls!
2018-08-24 20:45:11 -07:00
8ce7465bba Merge pull request #747 from robertohuertasm/feat/extends-promise
feat(extends): extend promise
2018-08-23 17:52:50 -07:00
042cfad5ce feat(extends): extend promise 2018-08-24 02:15:02 +02:00
045138f397 Merge pull request #744 from rustwasm/dependabot/npm_and_yarn/webpack-4.17.1
Bump webpack from 4.17.0 to 4.17.1
2018-08-23 09:25:13 -07:00
c99b27a367 Bump webpack from 4.17.0 to 4.17.1
Bumps [webpack](https://github.com/webpack/webpack) from 4.17.0 to 4.17.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.17.0...v4.17.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-23 08:12:54 +00:00
9442db46f1 Merge pull request #743 from rustwasm/dependabot/npm_and_yarn/webpack-4.17.0
Bump webpack from 4.16.5 to 4.17.0
2018-08-22 09:05:56 -07:00
304af77015 Bump webpack from 4.16.5 to 4.17.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.16.5 to 4.17.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.16.5...v4.17.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-22 08:12:59 +00:00
8ff0da6f85 Add more tests then comment them out 2018-08-21 14:07:29 +01:00
b8c1f72dab Comment out failing code 2018-08-21 13:55:14 +01:00
e92536f300 Allow Vec as well as slice 2018-08-21 13:47:00 +01:00
496d8cadd8 Actually span makes more sense on whole function 2018-08-21 13:12:25 +01:00
5342a26fd0 Clean up checking code a bit 2018-08-21 13:11:53 +01:00
385e805509 Work on review comments 2018-08-21 12:55:09 +01:00