squint-cljs / cherry

Experimental ClojureScript to ES6 module compiler
https://squint-cljs.github.io/cherry
558 stars 22 forks source link

Returning function body and await is not evaluating properly #44

Closed armed closed 2 years ago

armed commented 2 years ago

Example for function return:

(defn my-fun []
  (fn [] "foo"))

evaluates to (no return keyword)

var my_fun = function () {
  function () {
    return "foo";
  }
};

Example for await return:

(defn ^:async my-fun [url]
  (js/await (js/fetch url)))

evaluates to:

var my_fun = async function (url) {
  (await return fetch(url);)
};