Commit Graph

652 Commits

Author SHA1 Message Date
Nick Fitzgerald
a30ccd7c18 webidl: Use Default for pub tokens (#215) 2018-05-30 15:07:20 -05:00
Nick Fitzgerald
4a54e6fd52
Merge pull request #214 from fitzgen/webidl
Add a WebIDL frontend
2018-05-30 11:52:16 -07:00
Alex Crichton
6d23c8533b Avoid deprecated constructor 2018-05-29 18:02:00 -07:00
Alex Crichton
5e94dc2b75 Update parity-wasm dependency 2018-05-29 18:00:09 -07:00
Nick Fitzgerald
3879f6f427 Introduce the wasm-bindgen-webidl frontend
This is still a work in progress. Parse WebIDL source text and convert it into
wasm-bindgen AST, so that we can automatically emit bindings for the types and
functions described in the WebIDL.
2018-05-29 14:22:53 -07:00
Nick Fitzgerald
daabbbd06e Add a stub test module for when we have webidl tests 2018-05-29 14:20:15 -07:00
Nick Fitzgerald
3369498dca
Merge pull request #213 from fitzgen/ast-debug
backend: All AST types should implement Debug
2018-05-29 13:14:55 -07:00
Nick Fitzgerald
6885ea073e Only derive extra traits when the extra-traits feature is enabled 2018-05-29 11:24:40 -07:00
Nick Fitzgerald
07d5afa268 backend: All AST types should implement Eq 2018-05-25 16:33:22 -07:00
Nick Fitzgerald
018f083402 backend: All AST types should implement Debug 2018-05-25 16:20:07 -07:00
Nick Fitzgerald
50b8842b95 Add a feature for printing the macro's generated code (#212) 2018-05-25 18:17:54 -05:00
Alex Crichton
4c27c349ea Bump to 0.2.11 2018-05-24 08:56:28 -07:00
Alex Crichton
7009c506c1 Revert "Revert "Revert "Disable the span feature temporarily"""
This reverts commit b3cb44eb53.
2018-05-24 07:16:36 -07:00
Alex Crichton
151acf8eb3 Add an example of importing non-browser functions
Closes #208
2018-05-23 12:14:12 -07:00
Robert Masen
4ddd93d75d add char support (#206)
* add char support

* add char test

* remove __wbindgen_char fns

* re-order travis script

* update serve script

* remove binds to unused char functions

* add more wide character items to chars list

* remove unused code

* add char to readme

* remove built file
2018-05-22 12:34:41 -05:00
Alex Crichton
17861a45ab Improve the --wasm2asm flag of wasm2es6js
* Don't glob import modules an instead selectively only import required items
* Be compatible with node.js and avoid the usage of `self`
2018-05-22 08:31:35 -07:00
Alex Crichton
dd76707ea1 Prevent use-after-free with vectors
Awhile back slices switched to being raw views into wasm memory, but this
doens't work if we free the underlying memory unconditionally! Moving around a
`Vec` is already moving a lot of data, so let's copy it onto the JS heap instead
of leaving it in the wasm heap.
2018-05-21 11:23:46 -07:00
Alex Crichton
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
Alex Crichton
b3cb44eb53 Revert "Revert "Disable the span feature temporarily""
This reverts commit a10a0c8cfd.
2018-05-21 08:08:21 -07:00
Alex Crichton
a10a0c8cfd Revert "Disable the span feature temporarily"
This reverts commit 45b68870dc.
2018-05-21 07:30:10 -07:00
Alex Crichton
e76f5537e0 Upgrade to new versions of proc-macro2
Gonna get some nice spans back!
2018-05-21 07:29:34 -07:00
Alex Crichton
627ca1d638 Bump to 0.2.10 2018-05-17 10:40:24 -07:00
Alex Crichton
45b68870dc Disable the span feature temporarily
It's broken on nightly and needs fixing
2018-05-17 10:39:44 -07:00
Alex Crichton
5d28b90069 Bump to 0.2.9 2018-05-11 16:04:41 -07:00
Alex Crichton
7647019162 Fix build on CI 2018-05-11 08:48:42 -07:00
Alex Crichton
ca8809b4e9 Don't try to codegen static into an impl
Closes #194
2018-05-11 08:28:09 -07:00
Alex Crichton
06664b34ce Fix parsing some Rust keywords in attributes
Closes #193
2018-05-09 08:01:57 -07:00
Alex Crichton
8df5ea7084 Remove chrome examples from CI 2018-05-08 12:22:01 -07:00
Alex Crichton
b81864ecf4
Merge pull request #192 from xtuc/fix-bump-webpack
Bump webpack
2018-05-08 12:39:52 -05:00
Sven SAULEAU
fe60d48825
fix: bump webpack 2018-05-08 19:35:58 +02:00
Alex Crichton
cbcc300f71 Update webpack req in package.json 2018-05-07 07:38:11 -07:00
Alex Crichton
d04f8c7119 No more need for chrome workarounds! 2018-05-07 07:36:38 -07:00
Alex Crichton
94b59e0d6c
Merge pull request #191 from ngg/fix-no-modules-export
Fix generated binding for functions returning structs.
2018-05-06 11:20:11 -05:00
Gergely Nagy
02adf6defa Fix generated binding for functions returning structs.
This only affects --no-modules and --nodejs modes.

Fixes #190.
2018-05-06 18:17:33 +02:00
Alex Crichton
6d167116a0
Merge pull request #188 from rustwasm/u64
Map u64/i64 to BigInt in JS
2018-05-05 22:08:36 -05:00
Alex Crichton
237fff0698 Map u64/i64 to BigInt in JS
This commit is an implementation of mapping u64/i64 to `BigInt` in JS through
the unstable BigInt APIs. The BigInt type will ship soon in Chrome and so this
commit builds out the necessary support for wasm-bindgen to use it!
2018-05-05 18:51:20 -07:00
Alex Crichton
484fbbfe31
Merge pull request #189 from rustwasm/no-commit
Remove slice logic of "commit to wasm"
2018-05-05 16:55:43 -05:00
Alex Crichton
48a823c685 Remove slice logic of "commit to wasm"
When adding support for mutable slices I was under the impression that if the
wasm memory was reallocated while we were using it then we'd have to commit the
changes from the original buffer back to the new buffer. What I didn't know,
however, is that once the wasm memory is reallocated then all views into it are
supposed to be defunkt.

It looks like node 9 didn't have this implementation quite right and it appears
fixed in node 10, causing the deleted test here to fail. While this commit does
raise the question of whether this is the right approach to interact with slices
in JS I think the answer is still "yes". The user can always initiate the copy
if need be and that seems strictly better than copying 100% of the time.
2018-05-05 14:52:22 -07:00
Alex Crichton
bcf71cb571
Merge pull request #184 from rustwasm/str-slice
Don't use the global stack for string lengths
2018-05-03 11:04:51 -05:00
Alex Crichton
139b7a1aae Don't use the global stack for string lengths
This commit updates the `Abi` associated type for all slice types to a
`WasmSlice` type, an aggregate of two `u32` integers. This translates to an ABI
where when passed as a function argument it expands to two integer arguments,
and when passed as a return value it passes a return pointer as the first
argument to get filled in.

This is hopefully more forwards-compatible with the host bindings proposal which
uses this strategy for passing string arguments at least. It's a little sketchy
what we're doing as there's not really a stable ABI yet, but hopefully this'll
all be relatively stable for awhile!
2018-05-02 21:03:50 -07:00
Alex Crichton
4304a262c6 Fix enums defined in submodules 2018-05-02 10:17:16 -07:00
Alex Crichton
6c28e5f273
Merge pull request #183 from rustwasm/mutable-slices
Add support for mutable slices
2018-05-01 13:21:16 -05:00
Alex Crichton
0566a97485 Add support for mutable slices
This commit adds support for mutable slices to pass the boundary between JS and
Rust. While mutable slices cannot be used as return values they can be listed as
arguments to both exported functions as well as imported functions.

When passing a mutable slice into a Rust function (aka having it as an argument
to an exported Rust function) then like before with a normal slice it's copied
into the wasm memory. Afterwards, however, the updates in the wasm memory will
be reflected back into the original slice. This does require a lot of copying
and probably isn't the most efficient, but it should at least work for the time
being.

The real nifty part happens when Rust passes a mutable slice out to JS. When
doing this it's a very cheap operation that just gets a subarray of the main
wasm memory. Now the wasm memory's buffer can change over time which can produce
surprising results where memory is modified in JS but it may not be reflected
back into Rust. To accomodate this when a JS imported function returns any
updates to the buffer are copied back to Rust if Rust's memory buffer has
changed in the meantime.

Along the way this fixes usage of `slice` to instead use `subarray` as that's
what we really want, no copying. All methods have been updated to use `subarray`
accessors instead of `slice` or constructing new arrays.

Closes #53
2018-05-01 10:06:35 -07:00
Alex Crichton
fbb12f519b Bump to 0.2.8 2018-04-30 19:23:44 -07:00
Alex Crichton
85740a2591
Merge pull request #179 from rustwasm/wasm2asm
Add an example of `wasm2asm` and wasm-bindgen
2018-04-30 17:11:14 -05:00
Alex Crichton
dadcff15ef Add an example of wasm2asm and wasm-bindgen
This commit adds an example of executing the `wasm2asm` tool to generate asm.js
output instead of WebAssembly. This is often useful when supporting older
browsers, such as IE 11, that doesn't have native support for WebAssembly.
2018-04-30 13:29:34 -07:00
Alex Crichton
6f95e5c531 Print errors to stderr instead of stdout 2018-04-30 13:24:29 -07:00
Alex Crichton
7cef4a66b8 Merge remote-tracking branch 'alex/master' 2018-04-29 16:38:08 -07:00
Alex Crichton
9bab72034f
Merge pull request #175 from rustwasm/non-wasm
Enable `cargo test` where possible
2018-04-28 11:17:26 -05:00
Alex Crichton
befdf07a07 Bump to 0.2.7 2018-04-27 19:48:57 -07:00