Commit Graph

1533 Commits

Author SHA1 Message Date
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
597b697017 Forbid duplicated getter/setter names in fields and methods 2019-06-17 15:09:39 -03:00
3361e02caf Merge pull request #1601 from c410-f3r/unnecessary-result
Remove unnecessary Result return
2019-06-17 09:37:05 -05:00
af1f051e9b Typo 2019-06-17 11:36:51 -03:00
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
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
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
3b06e58c9e Handle more slice types in flag_slices_immutable
Should address the latest comment on #1539
2019-06-17 05:30:10 -07:00
00d47c1958 Remove unnecessary Result return 2019-06-16 22:24:27 -03:00
62681425b0 Update repository url 2019-06-16 19:52:11 -03:00
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
5a1dfdf2ab Fixing panic if the Future wakes up after returning Poll::Ready 2019-06-15 15:08:34 +02:00
8fc0a38402 Bump to 0.2.46 2019-06-14 11:44:58 -07:00
83a3f5d44a Run cargo fmt --all 2019-06-13 08:30:06 -07:00
1c558fac92 Merge pull request #1592 from alexcrichton/explicit-self
Include self-pointer in `Function` descriptions
2019-06-11 17:11:58 -05:00
80c75df166 Merge pull request #1590 from alexcrichton/intrinsics
Correct some intrinsic signatures
2019-06-11 14:53:22 -05:00
754328bef2 Merge pull request #1589 from alexcrichton/clamped
Remove the `Clamped` descriptor type
2019-06-11 14:53:15 -05:00
afbd7d3ff8 Include self-pointer in Function descriptions
Previously a `Function` didn't actually take into account the self
pointer and instead left it as an implicit argument. This instead
ensures that there's a `Descriptor::I32` type inside of a `Function`
description that we have to later skip, and this should not only make
the anyref pass correct for Rust exports but it should also make it more
accurate for future webidl transformations.
2019-06-11 12:51:53 -07:00
ce4cc317e8 Correct some intrinsic signatures
While this doesn't currently cause issues in the upcoming webidl
refactor this is actually being asserted and causes verification issues
if the types don't align!

These are basically just mistakes from the original implementation of
this module, but this doesn't actually fix a known bug today.
2019-06-11 11:56:08 -07:00
621fc9c440 Remove the Clamped descriptor type
This is just a bit too general to work with and is pretty funky. Instead
just tweak `Clamped<&[u8]>` to naturally generate a descriptor for
`Ref(Slice(ClampedU8))`, requiring fewer gymnastics when interpreting
descriptors.
2019-06-11 11:52:13 -07:00
6796bc6895 Communicate exceptions through global memory
Instead of allocating space on the stack and returning a pointer we
should be able to use a single global memory location to communicate
this error payload information. This shouldn't run into any reentrancy
issues since it's only stored just before returning to wasm and it's
always read just after returning from wasm.
2019-06-11 11:41:05 -07:00
535aa3193c Attempt to fix compilation issues on CI
Can't reproduce the errors on Azure locally, but hopefully tweaking
generated code can get things to work.
2019-06-10 08:47:19 -07:00
c3e0edd956 Merge pull request #1586 from alexcrichton/no-web-sys
Make `env_logger` an optional dependency
2019-06-10 10:47:14 -05:00
a7726545ac Merge pull request #1579 from ibaryshnikov/default-init-module
added default module path inside init function when target is web
2019-06-10 10:40:38 -05:00
5cf8224d99 Make env_logger an optional dependency
Only used during development no need to pull in its set of features when
typically compiled as a dependency of other crates!

Closes #1580
2019-06-10 07:12:44 -07:00
b205045424 Adding in AsRef impl for all wasm_bindgen types 2019-06-10 08:05:59 +02:00
8ace8287ff added default module path inside init function when target is web 2019-06-08 01:27:35 +03:00
e7e8ae1877 Fix getter and setter 2019-06-06 16:11:51 -03:00
59e773f5ec Update walrus 2019-06-05 11:08:04 -07:00
bf1a31e139 Don't generate a free function shim for classes
This was once required due to flavorful management of the `WeakRef`
proposal but nowadays it's simple enough that we don't need to refactor
it out here.
2019-06-05 07:52:14 -07:00
6e8c3e88f8 Directly import __wrap functions if possible
These can have similar optimizations as importing a value directly.
2019-06-05 07:52:14 -07:00
c22b907e7f Touch up some comments 2019-06-05 07:52:14 -07:00
ee426c03a9 Ensure that generated JS is deterministic
Iteration order of hash maps is nondeterministic, so add a `sorted_iter`
function and then use that throughout whenever iteration order of a hash
map would affect the generated JS.
2019-06-05 07:52:14 -07:00
cfd3e0406f Split symbol intrinsics into two
This allows using WebIDL bindings types to describe both of them instead
of having a custom ABI, allowing for more direct and rich bindings
eventually!
2019-06-05 07:52:14 -07:00
6f727d7c13 Refactor the module name slightly in gen_init 2019-06-05 07:52:14 -07:00
4eafaeae2d Handle the function table export on-demand
Don't delay processing until `finalize`, but instead process it as soon
as it's requested to avoid doing too much logic in `finalize`.
2019-06-05 07:52:14 -07:00
71209686e9 Use unwrap_call instead of an explicit match 2019-06-05 07:52:14 -07:00
c7021ba307 Update crates/cli-support/src/js/mod.rs
Co-Authored-By: Nick Fitzgerald <fitzgen@gmail.com>
2019-06-05 07:52:14 -07:00
3b5e3edd18 Fix anyref closure transformations
* Catch all closures by walking all `Descriptor` values and looking for
  either `Function` or `Closure`.
* Update the correct arguments for wasm by ensuring that the closure
  modifications skip the first two arguments.
2019-06-05 07:52:14 -07:00
b51df39bc9 Reimplement anyref processing and passes
This commit reimplements the `anyref` transformation pass tasked with
taking raw rustc output and enhancing the module to use `anyref`. This
was disabled in the previous commits during refactoring, and now the
pass is re-enabled in the manner originally intended.

Instead of being tangled up in the `js/mod.rs` pass, the anyref
transformation now happens locally within one module,
`cli-support/src/anyref.rs`, which exclusively uses the output of the
`webidl` module which produces a WebIDL bindings section as well as an
auxiliary wasm-bindgen specific section. This makes the anyref transform
much more straightforward and local, ensuring that it doesn't propagate
elsewhere and can be a largely local concern during the transformation.

The main addition needed to support this pass was detailed knowledge of
the ABI of a `Descriptor`. This knowledge is already implicitly
hardcoded in `js2rust.rs` and `rust2js.rs` through the ABI shims
generated. This was previously used for the anyref transformation to
piggy-back what was already there, but as a separate pass we are unable
to reuse the knowledge in the binding generator.

Instead `Descriptor` now has two dedicated methods describing the
various ABI properties of a type. This is then asserted to be correct
(all the time) when processing bindings, ensuring that the two are kept
in sync.
2019-06-05 07:52:14 -07:00
55fc5367a5 Fix a typo in the JsvalEq intrinsic
This is supposed to be `===`, not `==`.
2019-06-05 07:52:14 -07:00
cbd4b87d08 Fix handling imported memories
Need to make sure we update the import itself and configure the value on
the import object!
2019-06-05 07:52:14 -07:00
b4c395bd6e Fix an inverted condition for catch_and_throw 2019-06-05 07:52:14 -07:00
edd1469d21 Include docs in generated JS getters/setters 2019-06-05 07:52:14 -07:00
cba1e70077 Fix TypeScript output for fields 2019-06-05 07:52:14 -07:00
ff0a50e31e Fix failing interpreter tests 2019-06-05 07:52:14 -07:00
346868f78b Fix a failing CLI test 2019-06-05 07:52:14 -07:00
22b26db911 Use delete_typed to improve some ergonomics 2019-06-05 07:52:14 -07:00
e8e84a3f9c Remove __exports map on the web target
This is no longe rneeded now that we precisely track what needs to be
exported for an imported item, so all the imports are hooked up
correctly elsewhere without the need for the `__exports` map.
2019-06-05 07:52:14 -07:00
3e28e6ea46 Fix web, no-modules, and bundler output types
Make sure the wasm import definition map is hooked up correctly!
2019-06-05 07:52:14 -07:00