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

support variadic ^:async function with await #77

Closed
alexdao3 opened this issue Nov 8, 2022 · 1 comment
Closed

support variadic ^:async function with await #77

alexdao3 opened this issue Nov 8, 2022 · 1 comment

Comments

@alexdao3
Copy link
Contributor

alexdao3 commented Nov 8, 2022

In a variadic function, the await is transpiled into a non-async function, which is invalid javascript

(defn ^:async login-as
  "Attach email to user document and log in via custom token"
  [page uid-prefix & rest]
  (js/await 1))

compiles to

(function () {
 let f44 = function (var_args) {
let args4550 = array.call(null);
let len__22043__auto__51 = alength.call(null, arguments);
let i4652 = 0;
while(true){
if (truth_((i4652 < len__22043__auto__51))) {
args4550.push((arguments[i4652]));
let G__53 = (i4652 + 1);
i4652 = G__53;
continue;
};break;
}
;
let argseq__22205__auto__54 = ((2 < alength.call(null, args4550))) ? (new IndexedSeq(args4550.slice(2), 0, null)) : (null);
return f44.cljs$core$IFn$_invoke$arity$variadic((arguments[0]), (arguments[1]), argseq__22205__auto__54);
};
f44["cljs$core$IFn$_invoke$arity$variadic"] = function (page, uid_prefix, rest) {
return (await 1);
};
f44["cljs$lang$maxFixedArity"] = 2;
f44["cljs$lang$applyTo"] = function (seq47) {
let G__4855 = first.call(null, seq47);
let seq4756 = next.call(null, seq47);
let G__4957 = first.call(null, seq4756);
let seq4758 = next.call(null, seq4756);
let self__22052__auto__59 = this;
return self__22052__auto__59.cljs$core$IFn$_invoke$arity$variadic(G__4855, G__4957, seq4758);
};
return f44;
})
@borkdude
Copy link
Member

borkdude commented Nov 8, 2022

Thanks! PR welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants