Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e01b2a7

Browse filesBrowse files
committed
rearranging to highlight user intent
1 parent 8f6ebbf commit e01b2a7
Copy full SHA for e01b2a7

File tree

Expand file treeCollapse file tree

1 file changed

+24
-20
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-20
lines changed

‎src/clj/clojure/genclass.clj

Copy file name to clipboardExpand all lines: src/clj/clojure/genclass.clj
+24-20Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,33 @@
101101
'char Character/TYPE
102102
'chars (Class/forName "[C")})
103103

104-
(defn- maybe-array-descriptor [x]
105-
(if-let [dim (and (symbol? x)
106-
(namespace x)
107-
(clojure.lang.Util/isPosDigit (name x))
108-
(-> x name (.charAt 0) int (- (int \0))))]
109-
(let [cn (namespace x)
110-
^Iterable dim-descr (repeat dim "[")]
111-
(if-let [^Class pc (clojure.lang.Compiler/primClass (symbol cn))]
112-
(str (String/join "" dim-descr) (-> pc Type/getType Type/.getDescriptor))
113-
(str (String/join "" dim-descr) "L"
114-
(if (some #{\.} cn) cn (str "java.lang." cn))
115-
";")))
116-
(str x)))
104+
(defn- array-class? [x]
105+
(and (symbol? x)
106+
(namespace x)
107+
(clojure.lang.Util/isPosDigit (name x))))
108+
109+
(defn- resolve-array-class [x]
110+
(clojure.lang.RT/classForName
111+
(let [dim (-> x name (.charAt 0) int (- (int \0)))
112+
cn (namespace x)
113+
^Iterable dim-descr (repeat dim "[")]
114+
(if-let [^Class pc (clojure.lang.Compiler/primClass (symbol cn))]
115+
(str (String/join "" dim-descr) (-> pc Type/getType Type/.getDescriptor))
116+
(str (String/join "" dim-descr) "L"
117+
(if (some #{\.} cn) cn (str "java.lang." cn))
118+
";")))))
117119

118120
(defn- ^Class the-class [x]
119121
(cond
120-
(class? x) x
121-
(contains? prim->class x) (prim->class x)
122-
:else (let [strx (maybe-array-descriptor x)]
123-
(clojure.lang.RT/classForName
124-
(if (some #{\. \[} strx)
125-
strx
126-
(str "java.lang." strx))))))
122+
(class? x) x
123+
(symbol? x) (cond (contains? prim->class x) (prim->class x)
124+
(array-class? x) (resolve-array-class x)
125+
:else (let [strx (str x)]
126+
(clojure.lang.RT/classForName
127+
(if (some #{\. \[} strx)
128+
strx
129+
(str "java.lang." strx)))))
130+
:else (clojure.lang.RT/classForName x)))
127131

128132
;; someday this can be made codepoint aware
129133
(defn- valid-java-method-name

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.