Commit Graph

181 Commits

Author SHA1 Message Date
90882bb06f Mention enums in the README 2018-02-26 15:32:07 -08:00
00115c6e7d No longer generates TypeScript by default
remove an errant comment from the README
2018-02-26 15:31:18 -08:00
97c021a53c Merge pull request #36 from rylev/enums
C-Style Enums
2018-02-26 17:30:50 -06:00
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
f1b300c8aa get rid of unnecessary mutable var 2018-02-23 19:06:23 +01:00
3ae6614738 Add test for custom values in enums 2018-02-23 17:44:48 +01:00
f783876192 Support C-Style enums with custom int values 2018-02-23 17:38:02 +01:00
71880b8a83 Enums are numbers 2018-02-23 17:34:08 +01:00
3a270b6510 Add test for enums 2018-02-23 17:30:18 +01:00
89b0b8f20a Add section on node dependency in README 2018-02-23 14:52:45 +01:00
b78343a551 Fix enum formatting issues 2018-02-22 12:11:47 +01:00
7f8316f89b Clean up warnings 2018-02-22 12:08:28 +01:00
f11121b095 Generate enum js code 2018-02-22 12:01:38 +01:00
45543c545e Pass numbers in js as enums to Rust successfully 2018-02-22 10:55:44 +01:00
01c31cb33d Create Rust wrapping code for enums 2018-02-22 00:55:11 +01:00
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
0f8524da3c Ensure memory accesses are exposed before accessing 2018-02-18 23:55:34 +01:00
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
9e7a4e7e60 Fix a few more mistakes from slices 2018-02-16 19:19:31 -08:00
0970fa2998 Fix duplicated definition of a constant 2018-02-16 19:06:48 -08:00
3c58aa7310 Support integer/float slices/vectors
Closes #5
2018-02-16 18:58:37 -08:00
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
c148a3b6dc Emit JS with some more newlines
Hopefully helps a bit with readability!
2018-02-16 13:36:37 -08:00
9183236522 Implement getter/setter bindings 2018-02-14 13:16:02 -08:00
e72f9e176f Update DESIGN.md with import class shims 2018-02-14 12:54:37 -08:00
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
20bcc83b96 Merge pull request #20 from dflemstr/unsupported-exports
Don't panic on unsupported exports
2018-02-12 16:59:53 -06:00
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
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
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
7f94c662b9 Merge pull request #13 from froydnj/patch-1
small typo tweaks
2018-02-08 13:22:03 -06:00
646e7c92ba small typo tweaks 2018-02-08 14:09:36 -05:00
f49be45a92 Fix a typo for typescript bindings 2018-02-08 10:22:54 -08:00
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
70614f808e Remove stray mut 2018-02-06 19:14:54 -08:00
e9d612a343 Implement optionally catching exceptions 2018-02-06 19:04:12 -08:00
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
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
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
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
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
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
48db2f4b6e Minor typo fixes and a few wasm links added 2018-02-06 14:46:50 -06:00
aa90715896 Rename free functions to avoid gc'ing too much 2018-02-06 11:54:40 -08:00
7384bd1967 Fix some syntax highlighting 2018-02-06 11:48:12 -08:00
02abf588d5 Document the current design 2018-02-06 11:44:28 -08:00
56b7fa453a Fix some class import methods and auto gc
The runtime functions are now moved to the `wasm-bindgen` crate and are
auto-gc'd if they don't end up actually being required.
2018-02-06 08:58:15 -08:00
28966d9853 Fix String type in imports 2018-02-06 08:39:49 -08:00
d2f2ed8c1a Get the import-class test working 2018-02-06 08:23:51 -08:00
d5ff725913 Greatly simplify handling of types in Rust
Push the compiler to do trait resolution to figure out what each type is bound
with in JS, and that way we can accept effectively all types (so long as they
implement a trait).
2018-02-06 07:56:14 -08:00