Commit Graph

1674 Commits

Author SHA1 Message Date
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
Alex Crichton
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
dependabot[bot]
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
Alex Crichton
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
dependabot[bot]
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
Richard Dodd
8ff0da6f85 Add more tests then comment them out 2018-08-21 14:07:29 +01:00
Richard Dodd
b8c1f72dab Comment out failing code 2018-08-21 13:55:14 +01:00
Richard Dodd
e92536f300 Allow Vec as well as slice 2018-08-21 13:47:00 +01:00
Richard Dodd
496d8cadd8 Actually span makes more sense on whole function 2018-08-21 13:12:25 +01:00
Richard Dodd
5342a26fd0 Clean up checking code a bit 2018-08-21 13:11:53 +01:00
Richard Dodd
385e805509 Work on review comments 2018-08-21 12:55:09 +01:00
Alex Crichton
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
Alex Crichton
493cd24ace
Merge pull request #736 from alexcrichton/remove-wasmi
Remove dependency on `wasmi`
2018-08-20 15:18:03 -07:00
Alex Crichton
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
Alex Crichton
7486fa5104
Merge pull request #710 from RazerM/master
Add more WebAssembly bindings
2018-08-20 14:17:24 -07:00
Alex Crichton
3c3e6c4498 Provide no input for yarn
Hopefully it won't hang waiting for input as a result
2018-08-20 14:15:42 -07:00
Alex Crichton
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
Frazer McLean
1ea1410f98 Catch errors in Table and Module constructors 2018-08-20 22:12:29 +02:00
Frazer McLean
7432f5ff5c Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen 2018-08-20 21:55:42 +02:00
Alex Crichton
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
Alex Crichton
ccae331b2a
Merge pull request #740 from alexcrichton/catch-constructors
Fix the `constructor` and `catch` attributes combined
2018-08-20 11:37:02 -07:00
Alex Crichton
66d96aac11 Fix merge conflicts with fetch example 2018-08-20 11:23:02 -07:00
Alex Crichton
285a7bf7da
Merge pull request #713 from alexcrichton/weakref
Add experimental support for `WeakRef`
2018-08-20 11:18:40 -07:00
Alex Crichton
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
Alex Crichton
f8cf4ab732 Support importing same-name statics from two modules
Closes #714
2018-08-20 10:56:58 -07:00
Alex Crichton
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
Alex Crichton
adcc0dd23e
Merge pull request #729 from eminence/fetch
Initial example for the Fetch API
2018-08-20 10:35:57 -07:00
Alex Crichton
3b02b8e319
Merge pull request #731 from alexcrichton/rename-usv-str
Tweak some WebIDL type names in methods
2018-08-20 10:32:15 -07:00
Alex Crichton
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
Alex Crichton
8f2342b338
Merge pull request #717 from alexcrichton/shorter-names
Skip args in overloaded method names if all same
2018-08-20 10:30:16 -07:00
Alex Crichton
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
Andrew Chin
e4093eb178 No more use_extern_macros feature! 2018-08-20 13:19:00 -04:00
Alex Crichton
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
Alex Crichton
e92aeed214
Merge pull request #738 from Hywan/string-split
feat(js-sys) Implement `String.split` with regexp.
2018-08-20 07:53:57 -07:00
Ivan Enderlin
1e27b588e2
feat(js-sys) Implement String.replace(&str, …). 2018-08-20 11:01:56 +02:00
Ivan Enderlin
a9a1e69f30
feat(js-sys) Implement String.split with regexp. 2018-08-20 10:42:12 +02:00
Alex Crichton
6d49c76bc4
Merge pull request #734 from alexcrichton/stabilize
Remove `use_extern_macros` features
2018-08-19 18:12:00 -07:00
Frazer McLean
19ee28d769 Don’t need catch for Module static methods 2018-08-20 01:50:27 +02:00
Andrew Chin
2c72eabea1 Make the list of examples alphabetical, and add webaudio and fetch examples 2018-08-19 18:41:02 -04:00
Andrew Chin
9d7c0af08f Initial example for the Fetch API 2018-08-19 18:41:02 -04:00
Alex Crichton
4c1bf937f2 Move the unsize feature behind a nightly Cargo feature
This should fully stabilize the `wasm-bindgen` crate, preparing us for stable
Rust!
2018-08-19 14:45:59 -07:00
Alex Crichton
305ecb7910 Remove nll feature from webaudio example 2018-08-19 14:42:25 -07:00
Alex Crichton
d4297ad2d3 Remove use_extern_macros features
This has now been stabilized!
2018-08-19 14:33:01 -07:00
Alex Crichton
f8605108b7
Merge pull request #732 from quelledanielle/js_string_bindings
Add remaining String.prototype bindings
2018-08-19 13:41:45 -07:00
Danielle Pham
4f294224f0 Add bindings for String.prototype.split 2018-08-19 15:09:45 -04:00
Danielle Pham
8698084a43 Add binding for String.prototype.search 2018-08-19 14:52:10 -04:00