<< Back to previous view

[CLJS-715] Numbers are always emitted as literals Created: 06/Dec/13  Updated: 01/Jul/14  Resolved: 01/Jul/14

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: George Fraser Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

ClojureScript 2080

Attachments: File cljs_715_00.diff    


At the REPL:

> (.toString 1)
"Error evaluating:" (.toString 1) :as "1.toString()"
org.mozilla.javascript.EvaluatorException: missing ; before statement (<cljs repl>#3)

The emitted code `1.toString()` is a parse error, it should be `(1).toString()`

Comment by Alan Dipert [ 19/Jun/14 8:31 PM ]

I independently encountered this bug and came to the same conclusion about how to fix.

Attached is a patch that parenthesizes numbers without a trailing decimal, making method calls on them syntactically valid JavaScript.

Comment by David Nolen [ 01/Jul/14 9:34 PM ]

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

Generated at Thu Jan 18 22:03:59 CST 2018 using JIRA 4.4#649-r158309.