File tree
Expand file treeCollapse file tree2 files changed
+17
-6
lines changed Expand file treeCollapse file tree2 files changed
+17
-6
lines changed Original file line number | Diff line number | Diff line change |
---|
|
55 | 55 | (some #{(str name)} (ns-first-segments)) (inc d)
|
56 | 56 | :else d))))
|
57 | 57 |
|
| 58 | +(defn hash-scope [s] |
| 59 | +#?(:clj (System/identityHashCode s) |
| 60 | +:cljs (hash-combine (-hash ^not-native (:name s)) |
| 61 | +(shadow-depth s)))) |
| 62 | + |
58 | 63 | (declare munge)
|
59 | 64 |
|
60 | 65 | (defn fn-self-name [{:keys [name info] :as name-var}]
|
|
86 | 91 | (fn-self-name s)
|
87 | 92 | ;; Unshadowing
|
88 | 93 | (let [depth (shadow-depth s)
|
89 |
| -code #?(:clj (System/identityHashCode s) |
90 |
| -:cljs (-hash ^not-native name)) |
| 94 | +code (hash-scope s) |
91 | 95 | renamed (get *lexical-renames* code)
|
92 | 96 | name (cond
|
93 | 97 | (true? field) (str "self__." name)
|
|
862 | 866 | (map
|
863 | 867 | (fn [binding]
|
864 | 868 | (let [name (:name binding)]
|
865 |
| -(vector #?(:clj (System/identityHashCode binding) |
866 |
| -:cljs (-hash ^not-native name)) |
| 869 | +(vector (hash-scope binding) |
867 | 870 | (gensym (str name "-")))))
|
868 | 871 | bindings)))]
|
869 | 872 | (doseq [{:keys [init] :as binding} bindings]
|
|
Original file line number | Diff line number | Diff line change |
---|
|
93 | 93 |
|
94 | 94 | (deftest test-eval-str
|
95 | 95 | (async done
|
96 |
| -(let [l (latch 5 done)] |
| 96 | +(let [l (latch 6 done)] |
97 | 97 | (cljs/eval-str st "(+ 1 1)" nil
|
98 | 98 | {:eval node-eval}
|
99 | 99 | (fn [{:keys [error value]}]
|
|
139 | 139 | (fn [{:keys [error value]}]
|
140 | 140 | (is (nil? error))
|
141 | 141 | (is (== 3 (js/cljs.user.foo 1 2)))
|
| 142 | +(inc! l))) |
| 143 | +(cljs/eval-str st "(def foo (let [x 1] (let [x (inc x)] x)))" nil |
| 144 | +{:eval node-eval |
| 145 | +:context :statement |
| 146 | +:def-emits-var true} |
| 147 | +(fn [{:keys [error value]}] |
| 148 | +(is (nil? error)) |
| 149 | +(is (== 2 js/cljs.user.foo)) |
142 | 150 | (inc! l))))))
|
143 | 151 |
|
144 | 152 | #_(deftest test-eval-str-with-require
|
|
178 | 186 | (set! *main-cli-fn* -main)
|
179 | 187 |
|
180 | 188 | (comment
|
181 |
| -) |
| 189 | +) |
You can’t perform that action at this time.
0 commit comments