<< Back to previous view

[CLJS-428] Using */ inside of a docstring causes compiler to produce invalid JavaScript Created: 25/Nov/12  Updated: 19/Oct/15  Resolved: 13/Jul/15

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: 1.7.28

Type: Defect Priority: Minor
Reporter: Murphy McMahon Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Linux, lein-cljsbuild

Attachments: Text File cljs_428.patch     Text File cljs_428_v01.patch    


Due to how function docstrings are output by the ClojureScript compiler, the use of

within a docstring causes the compiler to produce invalid JavaScript, breaking compilation, since '*/' will close the docstring's JavaScript comment block and the remaining docstring text will be uncommented as a result.

Comment by Murphy McMahon [ 25/Nov/12 12:32 PM ]

I didn't realize JIRA treats asterisks as markup, so just for clarification: the characters that produce the defect are slash asterisk, ie JavaScript's block comment closing syntax.

Comment by David Nolen [ 22/Dec/12 3:30 PM ]

Do you have a suggested fix for this?

Comment by Sebastian Bensusan [ 18/May/15 7:23 AM ]

I added one extra step in cljs.compiler/emit-comment to replace all occurrences of "*/" into "* /" and it worked for V8, Spidermonkey, and Nashorn.


  • The patch includes a test.
  • I couldn't find a standard way to escape */ on JavaScript. If there are other suggestions, like *\/, I wouldn't mind resubmitting the patch.
Comment by Sebastian Bensusan [ 13/Jul/15 5:18 PM ]

Rebased patch.

Comment by David Nolen [ 13/Jul/15 5:45 PM ]

fixed https://github.com/clojure/clojurescript/commit/a660d8f882e6d9ec6578034336eaa87d1b8c478b

Generated at Wed Jan 16 23:53:23 CST 2019 using JIRA 4.4#649-r158309.