Commit Graph

84 Commits

Author SHA1 Message Date
e55af85edc Support by-value self methods (#348)
Refactor slightly to use the same internal support that the other reference
conversions are using.

Closes #329
2018-06-28 20:09:11 -05:00
4138583dff Support wildcard arguments in foreign functions (#351)
No real reason to not support them!

Closes #346
2018-06-28 20:06:35 -05:00
9127a0419f rustfmt all the things 2018-06-27 22:42:34 -07:00
2028efa76f Fix typo in backend crate 2018-06-26 13:17:40 +05:00
8fbf478058 Move some utility functions from the webidl crate into the backend crate 2018-06-25 10:45:53 -07:00
21fa3beabd backend: Add some trailing commas that rustfmt prefers 2018-06-25 10:45:53 -07:00
911a32c0d5 Add the #[wasm_bindgen(static_method_of = Class)] attribute
This is similar to `js_namespace` but translates into a static method on `Class`
rather than a free function. This allows us to have bindings to things like
`Object.keys` as `Object::keys`.
2018-06-25 10:45:53 -07:00
d79f982a01 Merge pull request #295 from kzvi/js-class-attr
add js_class attribute for defining what class an imported method is for
2018-06-22 21:38:14 -07:00
2cfffc65d7 add js_class attribute for defining what class an imported method is for 2018-06-22 12:12:43 -07:00
3bce3fb7a5 backend: Tidy up whitespace
* Remove trailing space on line.
* Ensure that there is a newline at the end of the file.
2018-06-22 11:14:33 -07:00
24f72c9680 backend: Remove unused import from ast module 2018-06-22 11:14:16 -07:00
5eda5504e9 Merge pull request #273 from FreeMasen/validate-ptr
Validate ptr
2018-06-19 16:45:31 -07:00
224d20337f Merge pull request #274 from fitzgen/js-sys
Expose objects and functions from the JavaScript global scope
2018-06-19 10:42:04 -07:00
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