Uploaded image for project: 'ClojureScript'
  1. CLJS-968

Metadata on function literal inside of a let produces invalid Javascript

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 1.7.145
    • Fix versions: 1.9.671
    • Labels:
      None
    • Environment:

      Originally found with [org.clojure/clojurescript "0.0-2496"]
      Still reproducible with the latest cljsc (b5e9a5116259fc9f201bee4b9c6564f35306f9a5)

      Description

      Here is a minimal test case that produces the invalid Javascript:

      (defn f []
        (let [a 0]
          ^{"meta" "data"}
          (fn [] true)))
      

      The compiled Javascript includes the invalid token sequence "return return". (Per Chrome: Uncaught SyntaxError: Unexpected token return)

      The problem does not occur if the metadata applies to a map literal instead of a function literal.
      The problem only occurs when the function and metadata are inside of a let.

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              alex+import import
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: