Commit Graph

2820 Commits

Author SHA1 Message Date
f1eaefdf0d fixed value types in Atomics methods 2019-04-24 00:25:25 +08:00
1071457c3d added SharedArrayBuffer and Atomics to js-sys 2019-04-24 00:01:15 +08:00
bc4a98d146 Add JsString <-> char conversions
These are pretty common and already supported via ABI conversions, yet pretty easy to get wrong when converting them manually.

Fixes #1363.
2019-04-23 15:54:06 +01:00
ac7230b678 Merge pull request #1479 from xeqlol/patch-1
guide: fixed typo in js-objects-in-rust.md
2019-04-22 10:44:24 -05:00
a0700f8de3 Merge pull request #1477 from lnicola/impl-debug-jsfuture
Implement Debug for JsFuture
2019-04-22 10:42:55 -05:00
735b1a1aa8 guide: fixed typo in js-objects-in.rust.md 2019-04-21 09:44:24 +05:00
04a78badc5 Implement Debug for JsFuture 2019-04-20 09:41:59 +03:00
7decb133f0 Merge pull request #1472 from c410-f3r/ts-methods
TS: Add docs for methods
2019-04-18 09:07:33 -07:00
59fd11b31c TS: Add docs for methods 2019-04-17 18:41:20 -03:00
805aaa2273 Log stacks of imported JS functions that throw but are not marked catch
Particularly useful in our tests, where we don't have the regular console
logging with post-facto object inspection, and instead need to provide all this
info up front.
2019-04-17 13:16:48 -07:00
68e6b4f187 Merge pull request #1469 from RReverser/fix-primitive-new-tests
Fix or suppress {primitive}::new warnings in tests
2019-04-17 13:25:06 -05:00
d7650863ab Fix or suppress {primitive}::new warnings in tests
Constructing boxed primitives was deprecated in #1447.

Some tests have been still using these methods, so this PR either updates them to use newly added {primitive}::from implementations or adds `#[allow(deprecated)]` where necessary.
2019-04-17 18:25:45 +01:00
3a7d384dc8 Generate bindings for indexed struct properties
This allows to export fields of tuple-like structs as indexed JS properties.
2019-04-17 12:56:14 +01:00
10cbc789a8 Install rustfmt on azure pipelines 2019-04-16 10:53:50 -07:00
ff1addbbaa Run cargo fmt 2019-04-16 10:52:27 -07:00
5ebfa27b62 Merge pull request #1465 from alexcrichton/only-node-tests
Add env vars to filter `wasm-bindgen-test-runner` tests
2019-04-16 12:42:27 -05:00
79f370deef Add env vars to filter wasm-bindgen-test-runner tests
This is intended to handle #1458 and #822. These issues stem from
behavior where:

    wasm-pack test --node

will actually run both Node.js and browser tests! Two new env vars are
read here, `WASM_BINDGEN_TEST_ONLY_{NODE,WEB}`, which control which
tests are executed by `wasm-bindgen-test-runner`. The intention is that
these will be set by `wasm-pack` to configure which tests are run, and
if test suites are skipped due to the env vars we'll print an
informational message indicating how they can be run.

Closes #822
Closes #1458
2019-04-16 10:42:16 -07:00
18746ecf4a Merge pull request #1461 from alexcrichton/rustfmt-web-sys
Format web-sys bindings by default
2019-04-15 12:36:28 -05:00
3ab9bb192a Merge pull request #1449 from alexcrichton/no-interface-objects
Support [NoInterfaceObject] in `web-sys`
2019-04-15 12:36:14 -05:00
01a52233d3 Support [NoInterfaceObject] in web-sys
This commit enables `[NoInterfaceObject]` annotated interfaces in
`web-sys`. The `NoInterfaceObject` attribute means that there's not
actually a JS class for the object, but all of its properties and such
can still be accessed structually and invoked. This should help provide
more bindings for some more common types on the web!

Note that this builds on recent features to ensure that `dyn_into` and
friends always fail for `NoInterfaceObject` objects because they don't
actually have a class.

Closes #893
Closes #1257
Closes #1315
2019-04-15 10:36:01 -07:00
fd4f0b6508 Format web-sys bindings by default
This commit switches to executing `rustfmt` by default on
`web-sys`-generated bindings. This improves situations like "view
source" in Rustdoc as well as the IDE interactive debugging experience.

This was initially disabled by default because `rustfmt` took so long to
execute, but nowadays `web-sys` is by default much smaller so there's
much less need to avoid running `rustfmt` in fear of it taking too
long.

Closes #1457
2019-04-15 08:33:02 -07:00
526b253b47 Merge pull request #1451 from RReverser/more-static-namespaces
Transform Math, Reflect and JSON into static namespaces
2019-04-15 09:41:40 -05:00
7ee4906661 Merge pull request #1410 from alexlapa/add-wasm-bindgen-skip-attr
Add wasm_bindgen(skip) attribute
2019-04-15 09:31:01 -05:00
7238807d53 Merge pull request #1459 from RReverser/dataview-methods
Fix more DataView documentation mistakes
2019-04-15 09:14:53 -05:00
ed45ca72da Fix more DataView documentation mistakes
I fixed few copy-paste mistakes in https://github.com/rustwasm/wasm-bindgen/pull/1372, but haven't noticed that they go even deeper :(
2019-04-15 14:31:23 +01:00
8b6dabcb5c add wasm_bindgen(skip) to reference 2019-04-14 23:49:24 +03:00
00c4dd9b6f Merge branch 'master' into add-wasm-bindgen-skip-attr 2019-04-14 23:43:21 +03:00
62b7d3e3c4 Transform JSON into a namespace 2019-04-13 02:22:19 +01:00
75c2971ab9 Transform Reflect into a namespace 2019-04-13 02:21:33 +01:00
fe939bc911 Transform Math into a namespace 2019-04-13 02:20:24 +01:00
744b031ad4 Merge pull request #1450 from RReverser/iter-is-type-of
Leverage new `is_type_of` for iterator protocol
2019-04-12 14:45:05 -05:00
2f524ee494 Leverage new is_type_of for iterator protocol
Treats any object of shape `{ next: function }` as an iterator via new `is_type_of` method. This is consistent with JavaScript iteration protocol which we already respect.

Also fixes a minor issue that `is_function` was unnecessarily called twice (once explicitly and once as part of `dyn_into` which now does the same check).
2019-04-12 20:30:41 +01:00
c4776becbb Touch up descriptions of has_type 2019-04-12 10:54:36 -07:00
657b97b6d8 Merge pull request #1405 from RReverser/instanceof
Add support for customising `instanceof` behaviour
2019-04-12 12:50:06 -05:00
1a40ba759c Merge pull request #1448 from alexcrichton/isize-usize
Add support for isize/usize arrays
2019-04-12 11:42:00 -05:00
c77b46af7d Add has_type and update is_instance_of docs 2019-04-12 17:41:51 +01:00
cb880bdbff Add customisable is_type_of 2019-04-12 17:23:42 +01:00
4211fcd992 Merge pull request #1444 from alexcrichton/partial-eq
Add PartialEq/Eq to many `js-sys` types
2019-04-12 11:03:05 -05:00
ba1f67d854 Remove some unnecessary unsafe in js-sys 2019-04-12 09:02:39 -07:00
df8da56a6c Add PartialEq/Eq to many js-sys types
This commit adds `#[derive(PartialEq, Eq)]` to many types throughout
`js-sys`. These types are basically all based on `Object`, which means
that `Object.is` can be used for `PartialEq` and the `Eq` requirements
are upheld.

The macro has also been updated to internally store the deref target
instead of unconditionally storing `JsValue`, allowing `#[derive]` to
work a bit better in these situations.
2019-04-12 09:02:33 -07:00
e39404e633 Add support for isize/usize arrays
Closes #1426
2019-04-12 08:56:36 -07:00
018b9b4e09 Fix compile of js-sys 2019-04-12 08:54:23 -07:00
529d0bd29a Merge pull request #1447 from alexcrichton/js-sys-tweaks
Improve Boolean/Number/JsString consistency
2019-04-12 10:50:56 -05:00
ba88ae8b64 Improve Boolean/Number/JsString consistency
* Ensure `PartialEq` is implemented from these types to native Rust types
* Implement `From` between these type and native Rust types
* Deprecated `Number::new` and `Boolean::new` to discourage use of the
  object forms, recommending the `from` constructors instead.

Closes #1446
2019-04-12 08:50:29 -07:00
df6e15e3ab Bump to 0.2.42 0.2.42 2019-04-11 07:39:45 -07:00
560cb022ca Merge pull request #1442 from alexcrichton/fix-encode-into
Fix a bug using `encodeInto` truncating strings
2019-04-11 09:34:16 -05:00
3906e4066d Fix a bug using encodeInto truncating strings
The last write accidentally wasn't accounted for in the returned length
of the string and we unfortunately don't have any test coverage of
`encodeInto` since it requires Firefox nightly right now (and doesn't
work in Node yet).

Closes #1436
2019-04-11 07:25:27 -07:00
d3fbf707e1 Merge pull request #1434 from alexcrichton/bump
Bump to 0.2.41
0.2.41
2019-04-10 16:11:34 -05:00
02394724ea Bump to 0.2.41 2019-04-10 10:53:32 -07:00
b670ea44d0 Merge pull request #1431 from alexcrichton/function-table
Add an accessor for the function table
2019-04-08 12:42:28 -05:00