Commit Graph

2722 Commits

Author SHA1 Message Date
Thomas den Hollander
8b99fdc745 Add truthy_falsy tests to main.rs 2019-08-08 09:17:38 +02:00
Thomas
0ee7236698 Define is_truthy in terms of is_falsy 2019-07-02 19:06:44 +02:00
Thomas
e61f691e0b Add is_truthy, is_falsy 2019-07-02 18:44:06 +02:00
Alex Crichton
bf631eda1b
Merge pull request #1633 from Warfields/master
Attempted to tackle #1622
2019-06-29 11:29:01 +02:00
Samuel Warfield
367a56eb25 Test are fully implemented 2019-06-28 14:14:27 -06:00
Samuel Warfield
06d0704cf8 Added tests for bind1() 2019-06-28 12:03:45 -06:00
Samuel Warfield
caa86a07a0 Attempted to tackle #1622 2019-06-27 15:48:18 -06:00
Alex Crichton
792ab403a1
Merge pull request #1625 from alexcrichton/less-return-ptr
Remove `__wbindgen_global_argument_ptr` intrinsic
2019-06-26 13:36:57 +02:00
Alex Crichton
250e84f091
Merge pull request #1620 from Pauan/add-typed-array-into
Add From impl for TypedArrays
2019-06-26 08:29:23 +02:00
Pauan
497c5ed423 Removing TODOs 2019-06-25 21:42:20 +02:00
Pauan
b9fd30b49e Adding in TODO note 2019-06-25 21:42:20 +02:00
Pauan
92a464d48e Updating a couple examples 2019-06-25 21:42:20 +02:00
Pauan
8cb9b88acb Adding in unit tests for From impl 2019-06-25 21:42:20 +02:00
Pauan
86937b9dba Adding in From impl for TypedArrays 2019-06-25 21:42:20 +02:00
Alex Crichton
e106ca3b61
Merge pull request #1626 from alexcrichton/more-standard
Update all non-mutable slices into Rust to use `AllocCopy`
2019-06-25 17:09:34 +02:00
Alex Crichton
b9c27b93a5 Update all non-mutable slices into Rust to use AllocCopy
This commit migrates all non-mutable slices incoming into Rust to use
the standard `AllocCopy` binding instead of using a custom `Slice`
binding defined by `wasm-bindgen`. This is done by freeing the memory
from Rust rather than freeing the memory from JS. We can't do this for
mutable slices yet but otherwise this should be working well!
2019-06-25 05:44:32 -07:00
Alex Crichton
eb550f5b4f Remove __wbindgen_global_argument_ptr intrinsic
We don't actually need this since we can simply pass in a number like 8
for the return pointer all the time. There's no need to allocate more
space in static data for a return pointer tha may not even get used!
2019-06-25 05:24:08 -07:00
Alex Crichton
e16dd15697
Merge pull request #1624 from alexcrichton/less-stack
Remove the long-defunkt `Stack` trait
2019-06-25 14:22:12 +02:00
Alex Crichton
a021a967b2 Remove the long-defunkt Stack trait
This was used oh-so-long ago but hasn't been used in a very long time
since then. It's served no purpose for a very long time now and I don't
think we have a plan for giving it a purpose any time soon, so let's
remove it.
2019-06-25 05:08:50 -07:00
Alex Crichton
d9e53ac2f6 Switch to debug_assert_eq! in intrinic
Reduce the code size of wasm files by avoiding an `assert_eq!` and panic
code in production builds.
2019-06-25 04:55:16 -07:00
Alex Crichton
b601c3fb2e Revert add example to what was originally intended
Remove stray debugging code added in the meantime.
2019-06-25 04:51:52 -07:00
Alex Crichton
1beb19b698
Merge pull request #1616 from najamelan/fix/travis
Simplify instructions for CI testing of wasm code
2019-06-25 13:39:41 +02:00
Alex Crichton
597d66ab87 Update git repo for wasm-webidl-bindings 2019-06-25 01:16:00 -07:00
Naja Melan
e41bd688d0
remove warning about caching 2019-06-25 08:15:35 +00:00
Alex Crichton
e0ef329e17
Merge pull request #1594 from alexcrichton/webidl-for-realz
Second large refactor for WebIDL bindings
2019-06-25 08:21:24 +02:00
Alex Crichton
c664110d9f
Merge pull request #1618 from alexcrichton/update-webgl
Use `view` instead of `subarray` in WebGL example
2019-06-23 13:28:00 -05:00
Alex Crichton
7f55067fa0
Merge pull request #1617 from alexcrichton/fix-gc
Be sure to GC our imports as well as the module
2019-06-23 13:27:50 -05:00
Alex Crichton
04aea4e9ab Use view instead of subarray in WebGL example
Pointed out in #1615!
2019-06-23 08:29:47 -07:00
Alex Crichton
2e03961ca1 Be sure to GC our imports as well as the module
After a module goes through its primary GC pass we need to look over the
set of remaining imports and use that to prune the set of imports that
we're binding.

Closes #1613
2019-06-23 08:16:11 -07:00
Naja Melan
5bb6c6c577
Simplify instructions for CI testing of wasm code
After discussion on #1611, this replaces the complicated setup with the automated install of wasm-pack.

I have added a note on caching, which I think would be useful to users, since the installer is really stuborn about not wanting to be automated. eg. `yes | installer` won't work. You have to remove all wasm-pack binaries before running it in order for it to be automated.
2019-06-23 15:12:46 +00:00
Alex Crichton
3cc30843e3 Second large refactor for WebIDL bindings
This commit is the second, and hopefully last massive, refactor for
using WebIDL bindings internally in `wasm-bindgen`. This commit actually
fully executes on the task at hand, moving `wasm-bindgen` to internally
using WebIDL bindings throughout its code generation, anyref passes,
etc. This actually fixes a number of issues that have existed in the
anyref pass for some time now!

The main changes here are to basically remove the usage of `Descriptor`
from generating JS bindings. Instead two new types are introduced:
`NonstandardIncoming` and `NonstandardOutgoing` which are bindings lists
used for incoming/outgoing bindings. These mirror the standard
terminology and literally have variants which are the standard values.
All `Descriptor` types are now mapped into lists of incoming/outgoing
bindings and used for process in wasm-bindgen. All JS generation has
been refactored and updated to now process these lists of bindings
instead of the previous `Descriptor`.

In other words this commit takes `js2rust.rs` and `rust2js.rs` and first
splits them in two. Interpretation of `Descriptor` and what to do for
conversions is in the binding selection modules. The actual generation
of JS from the binding selection is now performed by `incoming.rs` and
`outgoing.rs`. To boot this also deduplicates all the code between the
argument handling of `js2rust.rs` and return value handling of
`rust2js.rs`. This means that to implement a new binding you only need
to implement it one place and it's implemented for free in the other!

This commit is not the end of the story though. I would like to add a
mdoe to `wasm-bindgen` that literally emits a WebIDL bindings section.
That's left for a third (and hopefully final) refactoring which is also
intended to optimize generated JS for bindings.

This commit currently loses the optimization where an imported is hooked
up by value directly whenever a shim isn't needed. It's planned that
the next refactoring to emit a webidl binding section that can be added
back in. It shouldn't be too too hard hopefully since all the
scaffolding is in place now.

cc #1524
2019-06-20 19:16:10 -07:00
Alex Crichton
a1fc270f2a
Merge pull request #1608 from alexcrichton/bump
Bump to 0.2.47
2019-06-19 16:46:46 -05:00
Alex Crichton
b7b92cffe2 Update mdbook install 2019-06-19 13:49:57 -07:00
Alex Crichton
d71ab78fc6 Bump to 0.2.47 2019-06-19 11:14:37 -07:00
Alex Crichton
9b8191efb1
Merge pull request #1605 from c410-f3r/getters-check
Forbid duplicated getter/setter names in fields and methods
2019-06-19 13:11:17 -05:00
Alex Crichton
e7902f384f
Merge pull request #1606 from alexcrichton/gc-elss
Preserve the function table during early gc passes
2019-06-19 13:10:45 -05:00
Alex Crichton
c9ee88bda3 Preserve the function table during early gc passes
Recent refactorings of wasm-bindgen have inserted multiple `gc` passes
executed by walrus. In these passes though the function table was being
removed a bit too aggressively because it's not exported by LLD and it's
only later that we realize we need to export it.

To handle this case we add synthetic and temporary exports of the
function table and these exports are removed just after the GC pass in
question.

Closes #1603
2019-06-18 11:04:17 -07:00
Alex Crichton
8d90655f98
Merge pull request #1602 from alexcrichton/more-immutable
Handle more slice types in `flag_slices_immutable`
2019-06-18 11:04:09 -07:00
Alex Crichton
1aa6773c47
Merge pull request #1604 from marienz/link-utils-mixin
Make HTMLHyperlinkElementUtils a mixin, not a NoInterfaceObject
2019-06-17 16:56:21 -07:00
Caio
597b697017 Forbid duplicated getter/setter names in fields and methods 2019-06-17 15:09:39 -03:00
Alex Crichton
3361e02caf
Merge pull request #1601 from c410-f3r/unnecessary-result
Remove unnecessary Result return
2019-06-17 09:37:05 -05:00
Caio
af1f051e9b Typo 2019-06-17 11:36:51 -03:00
Alex Crichton
b5da08c6a0
Merge pull request #1598 from Pauan/fix-futures
Fixing panic if the Future wakes up after returning Poll::Ready
2019-06-17 09:36:24 -05:00
Marien Zwart
46e3cd5aa2 Make HTMLHyperlinkElementUtils a mixin, not a NoInterfaceObject
Commit b8afa0abde converted several interfaces
from NoInterfaceObject to mixins. It looks like it missed
HTMLHyperlinkElementUtils: it did update the interfaces that use
HTMLHyperlinkElementUtils (from "implements" to "includes"), but did not mark
HTMLHyperlinkElementUtils as a mixin.

Fix it, which makes HtmlAnchorElement gain useful functions like `set_href`.
2019-06-18 00:25:56 +10:00
Alex Crichton
379cad047a
Merge pull request #1599 from marienz/typescript-init
Make the argument to init optional in the Typescript declaration too
2019-06-17 07:32:09 -05:00
Alex Crichton
3b06e58c9e Handle more slice types in flag_slices_immutable
Should address the latest comment on #1539
2019-06-17 05:30:10 -07:00
Alex Crichton
f1cd643992
Merge pull request #1600 from c410-f3r/repo-url
Update repository url
2019-06-17 07:18:50 -05:00
Caio
00d47c1958 Remove unnecessary Result return 2019-06-16 22:24:27 -03:00
Caio
62681425b0 Update repository url 2019-06-16 19:52:11 -03:00
Marien Zwart
1b91457200 Make the argument to init optional in the Typescript declaration too
Commit 8ace8287ff made the argument to the
generated init() function optional (when the target is "web"), but it is still
marked as required in the generated .d.ts file.

Fix the generated declaration to match the function definition again.
2019-06-16 21:34:31 +10:00