Commit Graph

171 Commits

Author SHA1 Message Date
d9cac3bd90 Don't document descriptor functions
They aren't part of any public API, and are just an implementation detail of
wasm-bindgen.
2018-06-18 16:44:19 -07:00
749ac6502f add ptr validation 2018-06-17 20:13:56 -05:00
0938858aa8 webidl: add support for static attributes 2018-06-15 12:22:14 -07:00
fe5cde8636 webidl: add support for static methods 2018-06-15 12:09:42 -07:00
639ccd53ce Merge pull request #269 from ohanar/webidl_constructor
webidl: add support for (named) constructors
2018-06-15 11:35:29 -07:00
19d6cf1488 Copy doc comments from Rust to JS (#265)
* backend comments complete

* better matching

* gen comments

* Add example

* Move test bindings gen to own fn

* move build step into build fn

* add fn to read js, refactor gen_bindings/test to allow for this

* Add comments test

* Update readmes

* add comments to travis

* fix broken tests

* +x on build.sh

* fix wbg cmd in build.sh

* Address fitzgen's comments
2018-06-15 09:20:56 -07:00
400015a061 webidl: refactor method/getter/getter generation 2018-06-14 14:39:04 -07:00
d065f4b05d webidl: add support for typedefs 2018-06-11 18:43:45 -07:00
7ea0a7cc26 webidl: emit methods for regular operations 2018-05-31 22:54:40 -07:00
c7819930b4 backend::ast: rustfmt 2018-05-31 22:52:43 -07:00
6885ea073e Only derive extra traits when the extra-traits feature is enabled 2018-05-29 11:24:40 -07:00
07d5afa268 backend: All AST types should implement Eq 2018-05-25 16:33:22 -07:00
018f083402 backend: All AST types should implement Debug 2018-05-25 16:20:07 -07:00
4c27c349ea Bump to 0.2.11 2018-05-24 08:56:28 -07:00
7009c506c1 Revert "Revert "Revert "Disable the span feature temporarily"""
This reverts commit b3cb44eb53.
2018-05-24 07:16:36 -07:00
cfe7ebd463 Disallow structs w/ lifetime/type parameters
These can't work currently with wasm-bindgen, but maybe one day!

Closes #200
2018-05-21 09:13:17 -07:00
b3cb44eb53 Revert "Revert "Disable the span feature temporarily""
This reverts commit a10a0c8cfd.
2018-05-21 08:08:21 -07:00
a10a0c8cfd Revert "Disable the span feature temporarily"
This reverts commit 45b68870dc.
2018-05-21 07:30:10 -07:00
e76f5537e0 Upgrade to new versions of proc-macro2
Gonna get some nice spans back!
2018-05-21 07:29:34 -07:00
627ca1d638 Bump to 0.2.10 2018-05-17 10:40:24 -07:00
45b68870dc Disable the span feature temporarily
It's broken on nightly and needs fixing
2018-05-17 10:39:44 -07:00
5d28b90069 Bump to 0.2.9 2018-05-11 16:04:41 -07:00
7647019162 Fix build on CI 2018-05-11 08:48:42 -07:00
ca8809b4e9 Don't try to codegen static into an impl
Closes #194
2018-05-11 08:28:09 -07:00
06664b34ce Fix parsing some Rust keywords in attributes
Closes #193
2018-05-09 08:01:57 -07:00
4304a262c6 Fix enums defined in submodules 2018-05-02 10:17:16 -07:00
fbb12f519b Bump to 0.2.8 2018-04-30 19:23:44 -07:00
7cef4a66b8 Merge remote-tracking branch 'alex/master' 2018-04-29 16:38:08 -07:00
befdf07a07 Bump to 0.2.7 2018-04-27 19:48:57 -07:00
4a873af8d1 Enable cargo test where possible
Currently `#[wasm_bindgen]` generates a bunch of references to symbols that
don't actually exist on non-wasm targets, making it more difficult to get a
crate working across multiple platforms. This commit updates the symbol
references to be dummy ones that panic on non-wasm targets to allow simple
testing/benchmarking to work on native targets.

While this isn't a perfect solution for #114 it's probably as good as we can do
for now pending upstream Cargo features, so I'm gonna say that it...

Closes #114
2018-04-27 15:01:35 -07:00
acb5eac96a Bump to 0.2.6 2018-04-26 19:14:09 -07:00
b7bbcf5ea9 Fix compat with current nightly 2018-04-26 19:12:56 -07:00
412bebca72 Add support for version specifications
This commit adds a `#[wasm_bindgen(version = "...")]` attribute support. This
information is eventually written into a `__wasm_pack_unstable` section.
Currently this is a strawman for the proposal in ashleygwilliams/wasm-pack#101
2018-04-25 22:23:02 -07:00
11e274b477 Add spans feature to control proc-macro2
Using `proc-macro2`'s `nightly` feature is a good default for most use cases.
However, it causes a build error if used together with crates such as
`cssparser` that also use `proc-macro2` from a build script.

This change adds a default enabled feature `spans` that users can disable if
they need to work around this conflict.

Fixes #160.
2018-04-25 14:42:21 -05:00
4436c0eae6 Avoid invoking a function pointer with JsStatic
The previous codegen wasn't enough to convince LLVM that the function pointer
was a constant value and could be aggressively inlined, so this updates the
`JsStatic` internals slightly to guarantee to LLVM that the function pointer is
constant and no dynamic dispatch is needed after all
2018-04-21 13:14:33 -07:00
7108206835 Implement readonly struct fields
Add support for `#[wasm_bindgen(readonly)]` which indicates that an exported
struct field is readonly and attempting to set it in JS will throw an exception.

Closes #151
2018-04-20 10:56:10 -07:00
3b4bf475be Bump to 0.2.5 2018-04-19 18:46:41 -07:00
c6f7d3dfd5 Fix methods returning Self
Rewrite any instance of `Self` to the name of the class

Closes #137
2018-04-19 18:43:37 -07:00
ce31859590 Generate accessors for public struct fields
Automatically infer public struct fields as "JS wants to access this" and
generate appropriate getters/setters for the field. At this time the field is
required to implement `Copy`, but we will probably want to relax that in the
future to at least encompass `JsValue` and maybe other `Clone` values as well.

Closes #121
2018-04-19 16:49:46 -07:00
748184ae66 Work with #![no_std] contexts
This commit adds support for both `#![no_std]` in the wasm-bindgen runtime
support (disabled by default with an on-by-default `std` feature). This also
adds support to work and compile in the context of `#![no_std]` crates.

Closes #146
2018-04-19 13:24:30 -07:00
792a8e132e Fix unused variables in generated code
Also deny all warnings in tests to prevent this creeping back in.

Closes #141
2018-04-19 13:16:59 -07:00
055a8fb803 Bump to 0.2.4 2018-04-18 07:18:11 -07:00
7d5f2e4152 Enable the visit feature of syn 2018-04-18 07:16:14 -07:00
c74230b4a9 Bump to 0.2.3 2018-04-17 13:07:43 -07:00
5efde3abe9 Be sure to generate classes for empty structs
Closes #131
2018-04-16 08:05:18 -07:00
3999642f66 Merge remote-tracking branch 'upstream/master' into new 2018-04-15 01:50:23 +02:00
f45ce1f239 Do only use ConstructorToken when needed
Also removing some effectively dead code
2018-04-15 01:29:09 +02:00
0e6325d833 Overhaul the conversion traits
This commit overhauls the conversion traits used for types crossing the Rust/JS
boundary. Previously there were a few ad-hoc traits but now there've been
slightly reduced and decoupled.

Conversion from Rust values to JS values is now exclusively done through
`IntoWasmAbi` with no special treatment for references. Conversion from JS to
Rust is a bit trickier as we want to create references in Rust which have
implications in terms of safety. As a result there are now three traits for
this, `FromWasmAbi`, `RefFromWasmAbi`, and `RefMutFromWasmAbi`. These three
traits are implemented for various types and specially dispatched to depending
on the type of argument in the code generator.

The goal of this commit is to lay the groundwork for using these traits in
closures with straightforward-ish definitions.
2018-04-14 12:01:07 -07:00
e87b32fb22 Allow arbitratry constructor names 2018-04-14 11:19:17 -07:00
32ab5a5644 Suppport for javascript constructors
This is a conservative version where the function used for the constructor must be called `new`
2018-04-14 11:19:17 -07:00