Commit Graph

1640 Commits

Author SHA1 Message Date
d9bc0a3176 Bump to 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.
2018-08-27 13:37:55 -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
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
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
042cfad5ce feat(extends): extend promise 2018-08-24 02:15:02 +02: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
bf791efe2c Fix wasm-interpreter with mixed types of imports
We counted all imports until the index of the descriptor function, now we only
count imported functions
2018-08-20 16:18:09 -07:00
6343f2659a Remove dependency on wasmi
This is a pretty heavyweight dependency which accounts for a surprising amount
of runtime for larger modules in `wasm-bindgen`. We don't need 90% of the crate
and so this commit bundles a small interpreter for instructions we know are only
going to appear in describe-related functions.
2018-08-20 15:14:56 -07:00
7486fa5104 Merge pull request #710 from RazerM/master
Add more WebAssembly bindings
2018-08-20 14:17:24 -07:00
2972599ee3 Fix some mistakes from WeakRef support
* Be sure to free the pointer, not `this.ptr` which is always 0
* Unconditionally attempt to free data and let Rust throw an exception if it's
  null
2018-08-20 14:14:55 -07:00
1ea1410f98 Catch errors in Table and Module constructors 2018-08-20 22:12:29 +02:00
7432f5ff5c Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen 2018-08-20 21:55:42 +02:00
86d1ab513b Merge pull request #741 from alexcrichton/duplicate-statics
Support importing same-name statics from two modules
2018-08-20 11:37:21 -07:00
ccae331b2a Merge pull request #740 from alexcrichton/catch-constructors
Fix the `constructor` and `catch` attributes combined
2018-08-20 11:37:02 -07:00
61491eafbf Add experimental support for WeakRef
This commit adds experimental support for `WeakRef` to be used to automatically
free wasm objects instead of having to always call the `free` function manually.
Note that when enabled the `free` function for all exported objects is still
generated, it's just optionally invoked by the application.

Support isn't exposed through a CLI flag right now due to the early stages of
the `WeakRef` proposal, but the env var `WASM_BINDGEN_WEAKREF` can be used to
enable this generation. Upon doing so the output can then be edited slightly as
well to work in the SpiderMonkey shell and it looks like this is working!

Closes #704
2018-08-20 11:18:02 -07:00
f8cf4ab732 Support importing same-name statics from two modules
Closes #714
2018-08-20 10:56:58 -07:00
4195af68e7 Fix the constructor and catch attributes combined
This commit fixes annotations that include both the `constructor` and `catch`
attributes on imported types, ensuring that we infer the right type being
returned after extracting the first type parameter of the `Result`.

Closes #735
2018-08-20 10:40:54 -07:00
ddc42738cf Tweak some WebIDL type names in methods
Instead of `dom_str`, `byte_str`, and `usv_str`, emit `str` for all of them.
Similarly for `unrestricted_f64` just do `f64` instead. This reflects how we
interpret the types already in terms of Rust types and although technically
makes it possible to have name collisions in WebIDL they don't come up in
practice.
2018-08-20 10:32:04 -07:00
92b7de3d3d Skip args in overloaded method names if all same
This commit updates how we name overloaded methods. Previously all argument
names were concatenated, but after this commit it only concatenates argument
names where at least one possibility has a different type. Otherwise if all
possibilities have the same type name it in theory isn't adding too much more
information!

Additionally this commit also switches to using `_with_` consistently everywhere
instead of `_with_` for constructors and `_using_` for methods.

Closes #712
2018-08-20 10:30:02 -07:00
a4bf239eff Merge pull request #739 from Hywan/string-replace-regexp
feat(js-sys) Implement `String.replace(&str, …)`
2018-08-20 07:55:05 -07:00
1e27b588e2 feat(js-sys) Implement String.replace(&str, …). 2018-08-20 11:01:56 +02:00
a9a1e69f30 feat(js-sys) Implement String.split with regexp. 2018-08-20 10:42:12 +02:00
6d49c76bc4 Merge pull request #734 from alexcrichton/stabilize
Remove `use_extern_macros` features
2018-08-19 18:12:00 -07:00
19ee28d769 Don’t need catch for Module static methods 2018-08-20 01:50:27 +02:00
d4297ad2d3 Remove use_extern_macros features
This has now been stabilized!
2018-08-19 14:33:01 -07:00
4f294224f0 Add bindings for String.prototype.split 2018-08-19 15:09:45 -04:00
8698084a43 Add binding for String.prototype.search 2018-08-19 14:52:10 -04:00
44877880bb Add bindings for String.prototype.replace 2018-08-19 14:42:22 -04:00
7b53b1c88e Add binding for String.prototype.match 2018-08-19 13:59:00 -04:00
b330bd1bf1 Refactor inheritance checks into their own tests 2018-08-19 11:27:04 -05:00
1762b3cba0 Add extends to js-sys:Intl.PluralRules 2018-08-19 11:03:55 -05:00
ee131888da Add extends to js-sys:Intl.NumberFormat 2018-08-19 10:19:03 -05:00
780c7236f1 Add extends to js-sys:Intl.DateTimeFormat 2018-08-19 10:13:25 -05:00
f0811d5ac0 Add extends to js-sys:Intl.Collater 2018-08-19 10:03:56 -05:00
003cf102f1 Fix webidl 2018-08-19 14:28:45 +01:00
7c83c73919 Comment typo 2018-08-19 13:41:23 +01:00
a4835304eb Add codegen to make test work. 2018-08-19 13:39:16 +01:00
9c6225fd80 Merge pull request #720 from kraai/patch-1
Test for and add extends attributes
2018-08-18 22:15:30 -07:00
1fd52b08a3 Merge pull request #724 from eminence/partial_mixin
Fix missing WindowOrWorkerGlobalScope partial interface mixins.
2018-08-18 22:10:17 -07:00