0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Restore performance optimization of direct prop access

Using safer optional chain operator
This commit is contained in:
Andrey Antukh 2023-10-06 12:18:01 +02:00 committed by Andrés Moya
parent b70880420a
commit ac207e276c

View file

@ -13,8 +13,8 @@
#?(:clj [clojure.core :as c]
:cljs [cljs.core :as c])
[app.common.data :as d]
[cuerdas.core :as str]
[cljs.analyzer.api :as aapi]))
[cljs.analyzer.api :as aapi]
[cuerdas.core :as str]))
(defmacro select-keys
"A macro version of `select-keys`. Useful when keys vector is known
@ -120,12 +120,9 @@
"A macro based, optimized variant of `get` that access the property
directly on CLJS, on CLJ works as get."
[obj prop]
;; This throws an exception if obj is nul, that does not occur with CLJ get.
;; This is causing many internal errors in places that obj null does not harm and should not throw.
;; (if (:ns &env)
;; (list (symbol ".") (with-meta obj {:tag 'js}) (symbol (str "-" (c/name prop))))
(list `c/get obj prop))
;;)
(if (:ns &env)
(list 'js* (c/str "(~{}?." (str/snake prop) ")") obj)
(list `c/get obj prop)))
(def ^:dynamic *assert-context* nil)