Commit Graph

937 Commits

Author SHA1 Message Date
Alex Crichton
1c8061e675 Implement a version string
Add a `--version` and `-V` to the command to print out the version
2018-03-01 19:19:12 -08:00
Alex Crichton
36f064bed0
Merge pull request #40 from rylev/return-vec-jsvalue
Enable returning a vector of js values
2018-02-28 11:59:15 -06:00
Ryan Levick
17ca87cabb Add to README that Vec<JsValue> cannot be passed to functions 2018-02-28 17:33:16 +01:00
Ryan Levick
37da9eba14 Address feedback on commit dab6ba1 2018-02-28 17:29:40 +01:00
Ryan Levick
dab6ba1df8 Enable returning a vector of js values 2018-02-28 10:56:56 +01:00
Alex Crichton
19f88f0fd2 Update parity-wasm dep 2018-02-26 17:11:56 -08:00
Alex Crichton
90882bb06f Mention enums in the README 2018-02-26 15:32:07 -08:00
Alex Crichton
00115c6e7d No longer generates TypeScript by default
remove an errant comment from the README
2018-02-26 15:31:18 -08:00
Alex Crichton
97c021a53c
Merge pull request #36 from rylev/enums
C-Style Enums
2018-02-26 17:30:50 -06:00
Alex Crichton
6a7c9710ca
Merge pull request #38 from rylev/readme-section-test
Add section on node dependency in README
2018-02-25 04:24:33 +09:00
Ryan Levick
f1b300c8aa get rid of unnecessary mutable var 2018-02-23 19:06:23 +01:00
Ryan Levick
3ae6614738 Add test for custom values in enums 2018-02-23 17:44:48 +01:00
Ryan Levick
f783876192 Support C-Style enums with custom int values 2018-02-23 17:38:02 +01:00
Ryan Levick
71880b8a83 Enums are numbers 2018-02-23 17:34:08 +01:00
Ryan Levick
3a270b6510 Add test for enums 2018-02-23 17:30:18 +01:00
Ryan Levick
89b0b8f20a Add section on node dependency in README 2018-02-23 14:52:45 +01:00
Ryan Levick
b78343a551 Fix enum formatting issues 2018-02-22 12:11:47 +01:00
Ryan Levick
7f8316f89b Clean up warnings 2018-02-22 12:08:28 +01:00
Ryan Levick
f11121b095 Generate enum js code 2018-02-22 12:01:38 +01:00
Ryan Levick
45543c545e Pass numbers in js as enums to Rust successfully 2018-02-22 10:55:44 +01:00
Ryan Levick
01c31cb33d Create Rust wrapping code for enums 2018-02-22 00:55:11 +01:00
Alex Crichton
4d86fca327
Merge pull request #34 from rylev/ensure-memory-exposed
Ensure Memory Accesses are Exposed Before Accessing
2018-02-19 10:35:07 +09:00
Ryan Levick
0f8524da3c Ensure memory accesses are exposed before accessing 2018-02-18 23:55:34 +01:00
Alex Crichton
d66bc25749 Automatically bind float math functions
These tend to have one "pretty obvious" definition in JS anyway, so
let's paper over this deficiency in rustc for now by automatically
resolving any imports for these functions.

Closes #28
2018-02-17 16:44:31 -08:00
Alex Crichton
9e7a4e7e60 Fix a few more mistakes from slices 2018-02-16 19:19:31 -08:00
Alex Crichton
0970fa2998 Fix duplicated definition of a constant 2018-02-16 19:06:48 -08:00
Alex Crichton
3c58aa7310 Support integer/float slices/vectors
Closes #5
2018-02-16 18:58:37 -08:00
Alex Crichton
7802535948 Fix #[wasm_bindgen] on structs with no exports
It should still be usable in other types!

Closes #27
2018-02-16 13:50:14 -08:00
Alex Crichton
c148a3b6dc Emit JS with some more newlines
Hopefully helps a bit with readability!
2018-02-16 13:36:37 -08:00
Alex Crichton
9183236522 Implement getter/setter bindings 2018-02-14 13:16:02 -08:00
Alex Crichton
e72f9e176f Update DESIGN.md with import class shims 2018-02-14 12:54:37 -08:00
Alex Crichton
be368a6570 Don't look up properties in import shims
This'll match more closely what wasm eventually does natively, which is
importing these functions directly and not allowing changing them over time.

Closes #25
2018-02-14 12:51:58 -08:00
Alex Crichton
20bcc83b96
Merge pull request #20 from dflemstr/unsupported-exports
Don't panic on unsupported exports
2018-02-12 16:59:53 -06:00
David Flemström
c0f2773c4e Don't panic on unsupported exports
It's most likely safe for us to skip exports that we don't yet
support.  Doing nothing will at least not hurt in those cases.
2018-02-12 17:49:26 -05:00
Alex Crichton
f3c0fc369a Fix compatibility with LLD
Ensure the runtime library is always at least linked as it has important symbols
that we'll use later.
2018-02-10 10:06:56 -08:00
Alex Crichton
75837925e9 Find static descriptions inside data nodes
Right now this library only works if the static description is the entire data
node, but with upcoming LLD support everything will be in one data node. This
updates the logic for finding/parsing the program to search through the entire
data node and also know how big a program description is when it finds it.
2018-02-10 10:05:43 -08:00
Alex Crichton
7f94c662b9
Merge pull request #13 from froydnj/patch-1
small typo tweaks
2018-02-08 13:22:03 -06:00
Nathan Froyd
646e7c92ba
small typo tweaks 2018-02-08 14:09:36 -05:00
Alex Crichton
f49be45a92 Fix a typo for typescript bindings 2018-02-08 10:22:54 -08:00
Alex Crichton
29771b574c Migrate from a macro to an attribute
This commit migrates from `wasm_bindgen!`-the-macro to
`#[wasm_bindgen]`-the-attribute. The actual mechanics of the macro are
relatively simple in just generating some shims here and there, but wrapping
everything in one huge macro invocation can often seem intimidating as it gives
off this feeling of "oh dear anything can happen here!" Using an attribute
should curb expectations much more greatly of "oh there's just some extra stuff
happening behind the scenes".

The usage is otherwise relatively straightforward and close to what it was
before, but check out the DESIGN.md/README.md changes for more info!
2018-02-08 10:18:16 -08:00
Alex Crichton
70614f808e Remove stray mut 2018-02-06 19:14:54 -08:00
Alex Crichton
e9d612a343 Implement optionally catching exceptions 2018-02-06 19:04:12 -08:00
Alex Crichton
43ee52bcbf Change schemes for encoding custom type names
Store JSON a utf-32, map hashes of names to a `char` and store that name
in the map, and then do a reverse mapping when generating JS
2018-02-06 16:56:26 -08:00
Alex Crichton
8312f3ae9f Fix programs with two wasm_bindgen! invocations
Saw the bug coming. Added an assert. Assert tripped. Bug now fixed!
2018-02-06 15:52:44 -08:00
Alex Crichton
2c7c2e7ae1 Cache more objects in generated JS bindings
Cache the `Uint8Array` and `Uint32Array` views into wasm memory as well as the
instances of `TextEncoder` and `TextDecoder`. Should hopefully help cut down on
gc traffic and otherwise convince the engine to keep these as long-lived
objects.
2018-02-06 15:33:17 -08:00
Alex Crichton
ec5f0a29f7 Add a #[wasm_bindgen(constructor)] attribute
This can be used for specifying that a static function should actually delegate
to `new`
2018-02-06 15:25:46 -08:00
Alex Crichton
e60aa6a990 Rename JsObject to JsValue
Let's reserve `JsObject` for something we actually know is an object
2018-02-06 15:04:46 -08:00
Alex Crichton
9de4f1106b
Merge pull request #12 from lukewagner/patch-1
Minor typo fixes and a few wasm links added
2018-02-06 14:55:47 -06:00
Luke Wagner
48db2f4b6e
Minor typo fixes and a few wasm links added 2018-02-06 14:46:50 -06:00
Alex Crichton
aa90715896 Rename free functions to avoid gc'ing too much 2018-02-06 11:54:40 -08:00