Skip to content
Browse files

trace: Allow dotrace to work on private var fns.

  • Loading branch information...
1 parent 3174885 commit 7362d7b5efb9947dfa9d90e79c1cd1daa7fbc085 @Chouser Chouser committed
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/main/clojure/clojure/contrib/trace.clj
View
14 src/main/clojure/clojure/contrib/trace.clj
@@ -88,11 +88,9 @@ code is doing."}
expressions in an environment in which the identifiers are bound to
the traced functions. Does not work on inlined functions,
such as clojure.core/+"
- [fns & exprs]
- (if (empty? fns)
- `(do ~@exprs)
- (let [func (first fns)
- fns (next fns)]
- `(let [f# ~func]
- (binding [~func (fn [& args#] (trace-fn-call '~func f# args#))]
- (dotrace ~fns ~@exprs))))))
+ [fn-names & exprs]
+ `(binding [~@(interleave fn-names
+ (for [func fn-names]
+ `(fn [& args#]
+ (trace-fn-call '~func (var ~func) args#))))]
+ ~@exprs))

0 comments on commit 7362d7b

Please sign in to comment.
Something went wrong with that request. Please try again.