Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async await support #5537

Merged
merged 51 commits into from
Jul 18, 2022
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0b07581
Experiment with async-await.
cristianoc May 19, 2022
0270e9c
Add example project `example-async`.
cristianoc May 19, 2022
1c501d0
Use @async attribute instead of an external.
cristianoc May 19, 2022
8ccd6fa
Remove old support for async primitive.
cristianoc May 19, 2022
e2dc279
Add recursive function to run all tests.
cristianoc May 19, 2022
1e3c8a8
Support for @await decorator.
cristianoc May 20, 2022
9e4f143
Support async callbacks.
cristianoc May 20, 2022
804a40f
tweak callback example
cristianoc May 20, 2022
c11c3ca
Add async list example.
cristianoc May 20, 2022
64c0057
Clean up treatment of async attribute.
cristianoc May 20, 2022
d3ce0a8
Work around funny pretty printer formatting of await.
cristianoc May 20, 2022
1d55824
Clean up.
cristianoc May 20, 2022
cb1568c
clean up dump
cristianoc May 20, 2022
813d98e
format dump
cristianoc May 20, 2022
b98bc9a
More cleanup.
cristianoc May 20, 2022
ee80cf6
Give error when awaiting not in an async context.
cristianoc May 20, 2022
cc05e6e
Give error when async is applied to a curried function.
cristianoc May 20, 2022
bf7fe9c
Less invasive change to the ppx.
cristianoc May 22, 2022
7384191
More ppx cleanup.
cristianoc May 22, 2022
42db790
Use dedicated ast functions.
cristianoc May 22, 2022
3d1d2e6
Add module Ast_await.
cristianoc May 22, 2022
af913a4
Lift restriction to uncurried functions.
cristianoc May 22, 2022
ab2cbec
Braces are preserved by reformatting, but belong to the same function.
cristianoc May 22, 2022
f8bb32d
Unusual uncurried function with 2 arguments.
cristianoc May 22, 2022
60809c5
Use .mjs in source dir.
cristianoc May 27, 2022
b3bb5e6
Add example fetch using result type.
cristianoc May 27, 2022
6ad7eb7
Add imaginary syntax.
cristianoc May 27, 2022
2811546
tweak imaginary syntax, free up "&&".
cristianoc May 27, 2022
2febc63
"and" seems more idiomatic
cristianoc May 27, 2022
7358623
Example with exception-annotated fetch.
cristianoc May 29, 2022
dc257ce
tweak example
cristianoc May 31, 2022
9456dfd
snapshot
cristianoc Jun 12, 2022
1aedc89
Rebase on latest 10.0 alpha compiler.
cristianoc Jul 5, 2022
412e390
Begin preparing for source syntax.
cristianoc Jul 7, 2022
815568e
Pull in the surface syntax from the syntax submodule.
cristianoc Jul 7, 2022
a3bc904
Make sure the example still builds.
cristianoc Jul 7, 2022
e00ef8b
Example: switch to the new `res.*` attributes.
cristianoc Jul 7, 2022
00ea266
Example: switch `async` to surface syntax.
cristianoc Jul 7, 2022
58f6857
Switch over await's to surface syntax.
cristianoc Jul 7, 2022
1fe1149
Sync latest surface syntax.
cristianoc Jul 7, 2022
57758b1
Almost reformat.
cristianoc Jul 7, 2022
2420fd1
One more syntax sync.
cristianoc Jul 7, 2022
6b0ed47
Update .prettierignore
cristianoc Jul 7, 2022
0c318fb
Rebase on latest compiler.
cristianoc Jul 11, 2022
ea05f76
remove example from experiments repo
cristianoc Jul 11, 2022
8cd6abe
Update .prettierignore
cristianoc Jul 11, 2022
8a38fb4
rebase on master and use latest syntax
cristianoc Jul 18, 2022
0787a02
Update CHANGELOG.md
cristianoc Jul 18, 2022
4928972
Update CHANGELOG.md
cristianoc Jul 18, 2022
9cc7c55
Only accept `res.async` and clean up Js_promise.
cristianoc Jul 18, 2022
920a2ba
Use record type for Fun payload in j.ml.
cristianoc Jul 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up dump
  • Loading branch information
cristianoc committed Jul 18, 2022
commit cb1568c288e1722fa5989c625be8acd2446e8ddc
12 changes: 6 additions & 6 deletions jscomp/core/js_dump.ml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ and pp_function ~return_unit ~async ~is_method cxt (f : P.t) ~fn_state
if the function does not capture any variable, then the context is empty
*)
let inner_cxt = Ext_pp_scope.sub_scope outer_cxt set_env in
let param_body b : unit =
let param_body () : unit =
if is_method then (
match l with
| [] -> assert false
Expand Down Expand Up @@ -394,24 +394,24 @@ and pp_function ~return_unit ~async ~is_method cxt (f : P.t) ~fn_state
return_sp f;
P.string f (L.function_async ~async);
P.space f;
param_body b
param_body ()
| No_name { single_arg } ->
(* see # 1692, add a paren for annoymous function for safety *)
P.cond_paren_group f (not single_arg) 1 (fun _ ->
P.string f (L.function_async ~async);
P.space f;
param_body b)
param_body ())
| Name_non_top x ->
ignore (pp_var_assign inner_cxt f x : cxt);
P.string f (L.function_async ~async);
P.space f;
param_body b;
param_body ();
semi f
| Name_top x ->
P.string f (L.function_async ~async);
P.space f;
ignore (Ext_pp_scope.ident inner_cxt f x : cxt);
param_body b)
param_body ())
else
(* print our closure as
{[(function(x,y){ return function(..){...}} (x,y))]}
Expand All @@ -434,7 +434,7 @@ and pp_function ~return_unit ~async ~is_method cxt (f : P.t) ~fn_state
| Is_return | No_name _ -> ()
| Name_non_top x | Name_top x ->
ignore (Ext_pp_scope.ident inner_cxt f x));
param_body b);
param_body ());
pp_paren_params inner_cxt f lexical;
P.string f L.rparen;
match fn_state with
Expand Down