Alex Crichton
4ceaf3e0f4
Some small cleanups ( #366 )
...
* No need for version deps in dev-deps
These are all internal so we can drop the version
* Remove wasm-bindgen-cli's parity-wasm dep
No longer needed
* Tweak file hierarchy in webidl tests
Use Cargo's conventions to avoid the need to define `[[test]]` sections
* Remove unused imports
2018-07-02 11:57:39 -05:00
Alex Crichton
e06255fba5
Don't generate JS bindings for unused imports
...
If a JS import's shim isn't actually imported that means that somewhere along
the way it was optimized out or it was never used in the first place! In that
case we can skip generation of the JS bindings for it as it's not needed.
2018-06-29 15:56:12 -07:00
Alex Crichton
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
Alex Crichton
9a3ff77ea9
Support returning custom types in imports ( #350 )
...
Closes #320
2018-06-28 20:08:02 -05:00
Alex Crichton
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
R. Andrew Ohana
7626b55d00
fix up some strings that looked funky after rustfmt
2018-06-27 22:45:33 -07:00
R. Andrew Ohana
9127a0419f
rustfmt all the things
2018-06-27 22:42:34 -07:00
xeqlol
2028efa76f
Fix typo in backend crate
2018-06-26 13:17:40 +05:00
Nick Fitzgerald
5adda0d591
Merge pull request #313 from jamen/support-rollup
...
Make JS use a '.wasm' extension when importing the binary
2018-06-25 15:34:58 -07:00
Jamen Marz
a596dc4129
Make JS use a '.wasm' extension when importing the binary
2018-06-25 15:26:30 -06:00
Nick Fitzgerald
8fbf478058
Move some utility functions from the webidl crate into the backend crate
2018-06-25 10:45:53 -07:00
Nick Fitzgerald
21fa3beabd
backend: Add some trailing commas that rustfmt prefers
2018-06-25 10:45:53 -07:00
Nick Fitzgerald
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
R. Andrew Ohana
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
kzvi
2cfffc65d7
add js_class attribute for defining what class an imported method is for
2018-06-22 12:12:43 -07:00
Nick Fitzgerald
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
Nick Fitzgerald
24f72c9680
backend: Remove unused import from ast module
2018-06-22 11:14:16 -07:00
Nick Fitzgerald
c63d57f6d7
Add some more doc comments
2018-06-22 11:10:37 -07:00
Nick Fitzgerald
5eda5504e9
Merge pull request #273 from FreeMasen/validate-ptr
...
Validate ptr
2018-06-19 16:45:31 -07:00
Nick Fitzgerald
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
Nick Fitzgerald
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
Nick Fitzgerald
132103eb06
cli-support: Ignore missing descriptor functions
...
This can happen when a nested dependency crate exports things but the root crate
doesn't use them. In these cases, it is fine to ignore the missing descriptor,
because the thing it describes was removed as dead code.
2018-06-18 16:41:01 -07:00
Robert Masen
749ac6502f
add ptr validation
2018-06-17 20:13:56 -05:00
R. Andrew Ohana
0938858aa8
webidl: add support for static attributes
2018-06-15 12:22:14 -07:00
R. Andrew Ohana
fe5cde8636
webidl: add support for static methods
2018-06-15 12:09:42 -07:00
Nick Fitzgerald
639ccd53ce
Merge pull request #269 from ohanar/webidl_constructor
...
webidl: add support for (named) constructors
2018-06-15 11:35:29 -07:00
Robert Masen
2d7e7cd73e
Update js formatting
2018-06-15 12:55:37 -05:00
Robert Masen
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
R. Andrew Ohana
cbec42e86c
webidl: add support for named constructors
2018-06-14 16:20:20 -07:00
R. Andrew Ohana
c65cb51fba
webidl: add support for constructors
2018-06-14 16:15:25 -07:00
R. Andrew Ohana
400015a061
webidl: refactor method/getter/getter generation
2018-06-14 14:39:04 -07:00
R. Andrew Ohana
be0e436c03
webidl: add basic support for attributes
2018-06-11 18:45:19 -07:00
R. Andrew Ohana
d065f4b05d
webidl: add support for typedefs
2018-06-11 18:43:45 -07:00
R. Andrew Ohana
04907477ba
webidl: translate methods from camelCase to snake_case
2018-06-09 21:49:42 -07:00
Santiago Pastorino
37eaca47b4
Pretty print output on main example
2018-06-07 14:58:20 -03:00
Santiago Pastorino
d6ec2289fc
Remove wrong types conversion from js to rust
...
We can revisit this when we have better tests.
2018-06-07 14:57:44 -03:00
Santiago Pastorino
fa8961e56a
Add prototype of wasm-bindgen-typescript
2018-06-04 17:28:12 -03:00
Nick Fitzgerald
8865e019f8
webidl: add features necessary to support Event.initEvent
...
1. Adds support for binding `DOMString` arguments to `&str`.
2. Ignore whether an argument is optional, and just always emit bindings for it.
2018-06-01 16:41:15 -07:00
Nick Fitzgerald
cb5bd3b9c9
Merge pull request #225 from fitzgen/webidl
...
webidl: Add logging and use env_logger in the tests
2018-06-01 16:09:36 -07:00
Nick Fitzgerald
8faebc56f2
webidl: Add logging and use env_logger in the tests
2018-06-01 16:09:15 -07:00
Alex Crichton
659583b40d
Implement PartialEq
for JsValue
( #217 )
...
Dispatch to JS's `===` operator internally
2018-06-01 16:47:45 -05:00
Alex Crichton
cb1e5cf136
Optimize JsValue::{from_bool, undefined, null} constructors ( #220 )
...
This commit optimizes constructing an instance of `JsValue` which is one of
`null`, `undefined`, `true`, or `false`. These are commonly created on the Rust
side of things and since there's only a limited set of values we can easily
prepopulate the global slab with a few entries and use hardcoded indices to
refer to these constants. This should avoid the need to travel into JS to insert
a `null` or and `undefined` into the global slab.
2018-06-01 16:46:42 -05:00
Nick Fitzgerald
346d2fda22
Merge pull request #223 from fitzgen/webidl
...
webidl: emit methods for regular operations on interfaces
2018-06-01 14:22:11 -07:00
Alex Crichton
a4428f01b6
Update parity-wasm dependency
2018-06-01 07:48:32 -07:00
Nick Fitzgerald
7ea0a7cc26
webidl: emit methods for regular operations
2018-05-31 22:54:40 -07:00
Nick Fitzgerald
c7819930b4
backend::ast: rustfmt
2018-05-31 22:52:43 -07:00
Nick Fitzgerald
ce8238cdd8
webidl: Compile and test the bindings emitted from WebIDL compilation
2018-05-31 22:52:43 -07:00
Nick Fitzgerald
a3d91bdd7c
webidl: make writing new tests really easy
2018-05-30 15:45:01 -07:00
Nick Fitzgerald
c773b29d6d
webidl: add compile
and compile_file
...
These will be the functions invoked by crates compiling WebIDL into wasm-bindgen
Rust sources inside `build.rs`.
2018-05-30 14:30:40 -07:00
Nick Fitzgerald
a30ccd7c18
webidl: Use Default for pub
tokens ( #215 )
2018-05-30 15:07:20 -05:00