|
1209 | 1209 | (defn analyze-keyword
|
1210 | 1210 | [env sym]
|
1211 | 1211 | (register-constant! env sym)
|
1212 |
| - {:op :constant :env env :form sym :tag 'cljs.core/Keyword}) |
| 1212 | + {:op :const :env env :form sym :tag 'cljs.core/Keyword}) |
1213 | 1213 |
|
1214 | 1214 | (defn get-tag [e]
|
1215 | 1215 | (if-some [tag (-> e :form meta :tag)]
|
|
1252 | 1252 | (defn infer-if [env e]
|
1253 | 1253 | (let [{{:keys [op form]} :test} e
|
1254 | 1254 | then-tag (infer-tag env (:then e))]
|
1255 |
| - (if (and #?(:clj (= op :constant) |
1256 |
| - :cljs (keyword-identical? op :constant)) |
| 1255 | + (if (and #?(:clj (= op :const) |
| 1256 | + :cljs (keyword-identical? op :const)) |
1257 | 1257 | (not (nil? form))
|
1258 | 1258 | (not (false? form)))
|
1259 | 1259 | then-tag
|
|
1310 | 1310 | :def (infer-tag env (:init e))
|
1311 | 1311 | :invoke (infer-invoke env e)
|
1312 | 1312 | :if (infer-if env e)
|
1313 |
| - :constant (case (:form e) |
| 1313 | + :const (case (:form e) |
1314 | 1314 | true BOOLEAN_SYM
|
1315 | 1315 | false BOOLEAN_SYM
|
1316 | 1316 | ANY_SYM)
|
|
1394 | 1394 | (assert (every? (fn [t]
|
1395 | 1395 | (or
|
1396 | 1396 | (-> t :info :const)
|
1397 |
| - (and (= :constant (:op t)) |
| 1397 | + (and (= :const (:op t)) |
1398 | 1398 | ((some-fn number? string? char?) (:form t)))))
|
1399 | 1399 | (apply concat tests))
|
1400 | 1400 | "case* tests must be numbers, strings, or constants")
|
|
1489 | 1489 |
|
1490 | 1490 | (defn constant-value?
|
1491 | 1491 | [{:keys [op] :as ast}]
|
1492 |
| - (or (= :constant op) |
| 1492 | + (or (= :const op) |
1493 | 1493 | (and (#{:map :set :vector :list} op)
|
1494 | 1494 | (every? constant-value? (:children ast)))))
|
1495 | 1495 |
|
|
3199 | 3199 | (if ^boolean (:quoted? env)
|
3200 | 3200 | (do
|
3201 | 3201 | (register-constant! env sym)
|
3202 |
| - (analyze-wrap-meta {:op :constant :env env :form sym :tag 'cljs.core/Symbol})) |
| 3202 | + (analyze-wrap-meta {:op :const :env env :form sym :tag 'cljs.core/Symbol})) |
3203 | 3203 | (let [{:keys [line column]} (meta sym)
|
3204 | 3204 | env (if-not (nil? line)
|
3205 | 3205 | (assoc env :line line)
|
|
3591 | 3591 | (instance? Character form) 'string
|
3592 | 3592 | (true? form) 'boolean
|
3593 | 3593 | (false? form) 'boolean)]
|
3594 |
| - (cond-> {:op :constant :env env :form form} |
| 3594 | + (cond-> {:op :const :env env :form form} |
3595 | 3595 | tag (assoc :tag tag))))))
|
3596 | 3596 |
|
3597 | 3597 | #?(:cljs
|
|
3613 | 3613 | (string? form) STRING_SYM
|
3614 | 3614 | (true? form) BOOLEAN_SYM
|
3615 | 3615 | (false? form) BOOLEAN_SYM)]
|
3616 |
| - (cond-> {:op :constant :env env :form form} |
| 3616 | + (cond-> {:op :const :env env :form form} |
3617 | 3617 | tag (assoc :tag tag))))))
|
3618 | 3618 |
|
3619 | 3619 | (defn analyze* [env form name opts]
|
|
0 commit comments