Commit Graph

1569 Commits

Author SHA1 Message Date
Nick Fitzgerald
e290c75c32 Add @afdw to the team! \o/ 2018-08-30 12:59:34 -07:00
Alex Crichton
e283093997 Fix the console_log example 2018-08-30 12:55:21 -07:00
Alex Crichton
dd3dba9285 Delete lots of now-unused code 2018-08-30 12:54:54 -07:00
Alex Crichton
923abc7d85 Migrate constructors to new naming scheme 2018-08-30 12:54:54 -07:00
Alex Crichton
5a4a34d4a1 Migrate methods to new naming scheme
Allows deletion of `create_basic_method`!
2018-08-30 12:54:54 -07:00
Alex Crichton
15d4338abe Reimplement name disambiguation on overloading
This commit reimplements how we disambiguate function names on overloading.
Previously functions would be first be disambiguated if they had multiple
instances of the same name, and *then* functions would be disambiguated
aftewards by if their arguments expanded to more than one type to generate.

This commit instead collects everything into one list during the first pass.
This one list contains all signatures known for a given name. Later this list is
walked in one pass to generate all methods necessary, expanding names all at
once instead of two steps.

This should improve the naming of methods across multiple functions which also
have optional arguments. Support in this commit is just enough for namespaces,
but following commits will update the strategy for mixins/interfaces.
Additionally only new code was added in this commit which duplicates a lot of
functionality, but subsequent commits will remove the old code that will
eventually no longer be used.
2018-08-30 12:54:54 -07:00
Alex Crichton
0a18ca4490 Minor tweaks to first_pass.rs
Nothing much of consequence
2018-08-30 12:54:54 -07:00
Alex Crichton
6cf3b90e63 Deindent a few helper functions in dictionaries
No need for it to be an inner function now that it's using methods!
2018-08-30 12:54:54 -07:00
Alex Crichton
4f76a00024 Refactor creation of functions in the backend
This commit refactors the lowest-level primitive for creating functions into a
new `create_one_function` function. This doesn't take into account overloading
but is suitable for things like `create_{getter,setter}`. Eventually the
overloading will be implemented in terms of this function.
2018-08-30 12:54:54 -07:00
Alex Crichton
0a38e44f1f Refactor a method for listing all mixins
This'll hopefully be reusable in more than one location!
2018-08-30 12:54:54 -07:00
Alex Crichton
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
Alex Crichton
d358fa0987
Merge pull request #766 from alexcrichton/remove-uint8-clamped-array
webidl: Remove support for Uint8ClampedArray
2018-08-30 12:53:37 -07:00
Alex Crichton
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
Alex Crichton
df19b63c60 Hack around a broken nightly 2018-08-30 10:33:45 -07:00
Nick Fitzgerald
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
Nick Fitzgerald
96573574c1 README: add features section describing goals/foundations/features of wasm-bindgen 2018-08-29 14:24:09 -07:00
Alex Crichton
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
Alex Crichton
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
Alex Crichton
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
Alex Crichton
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
Alex Crichton
447b42b7ac
Merge pull request #759 from alexcrichton/shared-memory-strings
Fix `getStringFromWasm` for shared memory
2018-08-28 12:16:52 -07:00
Alex Crichton
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
Alex Crichton
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
Alex Crichton
f7e6fa2a04 Bump dependency on parity-wasm to 0.32.0
Brings support for atomic instructions!
2018-08-28 10:12:56 -07:00
Alex Crichton
a48a35fe41 Fix npm ci on AppVeyor 2018-08-27 19:02:26 -07:00
Alex Crichton
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
Alex Crichton
7154372af9 Remove yarn tests on CI
We're not actually using them any more!
2018-08-27 17:39:40 -07:00
Alex Crichton
6c0a00ca39 Build tags on AppVeyor 2018-08-27 17:34:35 -07:00
Alex Crichton
b41ce52d98
Merge pull request #756 from fitzgen/mdn-links
js-sys: Make MDN URLs into links
2018-08-27 17:21:27 -07:00
Nick Fitzgerald
26c351ecf4 js-sys: Make MDN URLs into links 2018-08-27 15:18:48 -07:00
Alex Crichton
69a831423b Update publishing instructions
We've got a publish script now!
2018-08-27 13:51:47 -07:00
Alex Crichton
4863ccd100 Update CHANGELOG for 0.2.19 2018-08-27 13:49:34 -07:00
Alex Crichton
d9bc0a3176 Bump to 0.2.19 2018-08-27 13:39:23 -07:00
Alex Crichton
c89182b1fd Merge remote-tracking branch 'origin/master' into bump 2018-08-27 13:38:53 -07:00
Alex Crichton
98008b9e77 Bump to 0.2.18
At the same time, also add a `publish.rs` script to ease our publishing woes.
2018-08-27 13:37:55 -07:00
Alex Crichton
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
Alex Crichton
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
Alex Crichton
85fd49f90a Fix importing same types in two modules/crates
This'll hopefully fix fallout from 4f4da747ad
2018-08-27 09:59:47 -07:00
Alex Crichton
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
dependabot[bot]
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
Alex Crichton
9fc43f8a19
Merge pull request #752 from alexcrichton/remove-hack
Remove a hack around an LLVM bug
2018-08-26 15:43:07 -07:00
Alex Crichton
856892d11d
Merge pull request #750 from alexcrichton/import-memory
Add support for modules importing memory
2018-08-26 15:42:24 -07:00
Alex Crichton
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
Alex Crichton
0cd04ca85e
Merge pull request #749 from alexcrichton/wasm-memory
Add WebAssembly.Memory to js-sys
2018-08-26 15:40:58 -07:00
Alex Crichton
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
Alex Crichton
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
Nick Fitzgerald
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
Alex Crichton
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
Alex Crichton
8ce7465bba
Merge pull request #747 from robertohuertasm/feat/extends-promise
feat(extends): extend promise
2018-08-23 17:52:50 -07:00
Roberto Huertas
042cfad5ce feat(extends): extend promise 2018-08-24 02:15:02 +02:00