Commit Graph

849 Commits

Author SHA1 Message Date
Alex Crichton
f2254628dd Fix a typo 2018-03-31 14:26:00 -07:00
Alex Crichton
9bc2718943 Clean up a bit of duplication in codegen 2018-03-31 09:38:31 -07:00
Alex Crichton
7880545b3b Finish fixing fallout in all tests 2018-03-31 09:15:39 -07:00
Alex Crichton
2880247acf Get the imports test passing 2018-03-31 08:26:20 -07:00
Alex Crichton
cdbb31f3a9 Start removal of vector special-casing
This commit starts wasm-bindgen down a path of removing the special
casing it currently has around vectors, slices, and strings. This has
long been a thorn in wasm-bindgen's side as it doesn't handle other
kinds of vectors and otherwise is very inflexible with future additions.
Additionally it leads to a lot of duplicated-ish code throughout various
portions of codegen.

The fundamental reason for this was that two arguments were required to
be passed back to wasm, and I couldn't figure out a way to shove both
those arguments into a function argument. The new strategy here is that
there is one global stack well known to both JS and Rust which arguments
*may* also be transferred between.

By default all ABI arguments pass as literal function arguments, but if
two or more arguments need to be passed then the extra ones are all
passed through this global stack. The stack is effectively temporary
scratch space when crossing the JS/Rust boundary (both ways). No long
term storage is intended here.

The `simple` test is passing as a result of this commit, using strings
internally. The `Vector` type in the AST has been removed (yay!) and the
bulk of the implementation of slices and vectors now resides in the
`wasm-bindgen` crate itself, defining how to pass all these arguments
around. The JS generator, however, still needs to know about all the
sorts of vectors so it can generate appropriate code for JS.

Future commits will continue cleanup and get the rest of the tests
working.
2018-03-31 07:57:47 -07:00
Alex Crichton
25af16c7d9 Fix an unused mut warning 2018-03-31 02:35:09 -07:00
Alex Crichton
f86d227d51
Merge pull request #98 from corbinu/master
Fix import TextDecoder in output for nodejs config
2018-03-31 00:12:13 +02:00
Corbin Uselton
13520e324b Fix import TextDecoder in output for nodejs config 2018-03-30 10:50:01 -07:00
Alex Crichton
c97df46e08 Remove dummy test in backend 2018-03-29 14:51:00 -07:00
Alex Crichton
4e923445eb Remove executable bits 2018-03-29 14:50:40 -07:00
Alex Crichton
80243acc37 Fix running node tests 2018-03-29 14:49:36 -07:00
Ashley Williams
c525ecffc2 feat(test): add a failing math test 2018-03-29 22:29:39 +02:00
Alex Crichton
646df20d70 Fix a typo when running commands 2018-03-29 12:26:42 -07:00
Alex Crichton
afc43174d9
Merge pull request #95 from fitzgen/backend
Split out the AST and codegen into the wasm-bindgen-backend crate
2018-03-29 18:31:38 +02:00
Nick Fitzgerald
0bd54480c6 Split out the AST and codegen into the wasm-bindgen-backend crate 2018-03-29 09:14:32 -07:00
Alex Crichton
64dc1e8b45 Fix compilation of examples on Travis 2018-03-29 08:59:08 -07:00
Alex Crichton
3ceee55d14 Fix Travis (hopefully) 2018-03-29 08:50:08 -07:00
Alex Crichton
47da3a38a8
Merge pull request #94 from ashleygwilliams/node-modules
feat(enum): object.freeze the enum
2018-03-29 17:46:24 +02:00
Ashley Williams
3ed363ae39 feat(enum): object.freeze the enum 2018-03-29 17:30:28 +02:00
Alex Crichton
79ef5979f4
Merge pull request #93 from fitzgen/rename-directories
Rename directories to remove "wasm-bindgen-" prefix in sub-crates
2018-03-29 17:29:47 +02:00
Nick Fitzgerald
393841779a Rename directories to remove "wasm-bindgen-" prefix in sub-crates 2018-03-29 08:28:25 -07:00
Alex Crichton
95d38795a9
Merge pull request #91 from fitzgen/more-contrib
Update CONTRIBUTING.md
2018-03-29 17:28:03 +02:00
Nick Fitzgerald
1d186ebf14 Update CONTRIBUTING.md 2018-03-29 08:27:31 -07:00
Alex Crichton
31107db86d
Merge pull request #92 from ashleygwilliams/node-modules
feat(node): support node enums
2018-03-29 17:27:21 +02:00
Ashley Williams
ae51c3b6f7 feat(node): support node enums 2018-03-29 17:11:28 +02:00
Alex Crichton
0657cee698
Merge pull request #86 from ashleygwilliams/node-modules
Generate node.js `require` directives for `--nodejs`
2018-03-29 16:42:20 +02:00
Ashley Williams
256b34736e feat(node): support node classes 2018-03-29 16:08:50 +02:00
Alex Crichton
6347685976
Merge pull request #84 from ashleygwilliams/prereq-readme
doc(contributing): add a contributing.md
2018-03-29 13:19:38 +02:00
Alex Crichton
b21cfcc786
Merge pull request #85 from ashleygwilliams/no-yarn-lock
fix(ignore): ignore yarn.lock
2018-03-29 13:19:17 +02:00
Ashley Williams
61ea1b4b00 fix(ignore): ignore yarn.lock 2018-03-29 11:22:06 +02:00
Ashley Williams
2e5b6a28d3 doc(contributing): add a contributing.md 2018-03-29 11:17:35 +02:00
Alex Crichton
a0bfb8103b Generate node.js require directives for --nodejs 2018-03-29 01:47:44 -07:00
Alex Crichton
67737a2661
Merge pull request #82 from kedromelon/patch-1
fix "funtion" typo in readme
2018-03-29 08:59:23 +02:00
Noah Lemen
48040c85b5
fix "funtion" typo in readme
just noticed this while reading!
2018-03-28 19:20:19 -04:00
Alex Crichton
929badcee5
Merge pull request #81 from killercup/fix-browser-flag
Cli: Fix browser flag
2018-03-28 18:30:55 +02:00
Pascal Hertleif
7cc8ef58bd Cli: Fix browser flag 2018-03-28 17:26:46 +02:00
Alex Crichton
28c3fdddf5 Remove --nodejs-runtime-detect
Instead use it by default and add a --browser argument to explicity
remove the shim.

Closes #79
2018-03-28 07:37:56 -07:00
Alex Crichton
bde56d3a6e
Merge pull request #76 from dflemstr/fix-eqeqeq
Fix some JS == → === and != → !== occurrences
2018-03-25 07:57:01 -05:00
David Flemström
930219fc53 Fix some JS == → === and != → !== occurrences
These are the ones my linter complained about in particular
2018-03-25 12:15:34 +02:00
Alex Crichton
02b7021053 Leverage new rustc wasm features
This commit leverages two new attributes in the Rust compiler,
`#[wasm_custom_section]` and `#[wasm_import_module]`. These two attributes allow
removing a lot of hacks found in wasm-bindgen and also allows removing the
requirement of `wasm-opt` to remove the unused data sections.

This does require two new nightly features but we already required the
`proc_macro` nightly feature and these will hopefully be stabilized before that
feature!
2018-03-24 10:36:19 -07:00
Alex Crichton
dc03e6c84a Shuffle around travis builds a bit 2018-03-22 21:18:03 -07:00
Alex Crichton
dd83e54b67 Fix build script of wasm-in-wasm 2018-03-22 21:15:21 -07:00
Alex Crichton
5eff7c58f9 Tweak intro text 2018-03-22 19:14:37 -07:00
Alex Crichton
a4ed4331dd Debug mode is no longer buggy
Tweak instructions in README
2018-03-22 19:10:00 -07:00
Alex Crichton
a8799c049f Add a --lib argument to cargo new
The defaults will be changing soon!
2018-03-22 19:08:53 -07:00
Alex Crichton
d258ea4e2a The schema has definitely changed now 2018-03-22 19:07:20 -07:00
Alex Crichton
9d5b4ce2fb Add another example to travis 2018-03-22 19:06:23 -07:00
Alex Crichton
7ebc428646 Implement a js_name customization
This'll allow binding multiple signatures of a JS function as well as otherwise
changing the name of the JS function you're calling from the Rust function that
you're defining.

Closes #72
2018-03-22 19:05:14 -07:00
Alex Crichton
a8045fbbe9 Use custom setter string in dom example
That way we can stick with idiomatic Rust!
2018-03-22 18:24:57 -07:00
Alex Crichton
30936a6b22 Allow specifying getter/setter properties
Should help with style clashes!
2018-03-22 18:21:41 -07:00