如何在 Clojure 编译器中调试参数对我的函数的应用?

How do I debug the application of arguments to my function in the Clojure Compiler?

我的目的是调试 Clojure 编译器以进一步了解它。 (我的项目代码有助于实现此目的。)。

我已经在我的 IntelliJ IDE 中设置了 Clojure Compiler source 和我的项目 test

我已将 clojure 项目作为主项目,test 项目在 class 路径上。

我通过 clojure 项目中的 运行 clojure.main class 在调试器中触发 Clojure REPL。

我的 test 项目在 test.core core.clj 文件中有以下源代码:

(ns test.core
  (:gen-class))

(deftype SquarePeg [width length])

(deftype RoundHole [radius])

(def square-peg (SquarePeg. 5 50))

(defn insert-peg [^test.core.RoundHole peg]
    (println "insert-peg inserted with: " peg))

(defn -main
  "Insert a square peg in a round hole"
  [& args]
    (insert-peg square-peg)
  (println "Done."))

我设置了以下断点:

现在我正在做的是在打开断点后将以下函数调用粘贴到 REPL 中:

(insert-peg square-peg)

现在我看到的是上面代码中的 println(如 pr)通过 AFn.java 单个 arg 调用运行,但是对 insert-peg 的调用才不是。 (这就是我要调试的)。

(断点打开后第一个断点跳闸)。

我确实通过 Compiler.java 中的发射代码看到 insert-pegsquare-peg 运行 的声明 - 但我正在寻找的是 函数应用。我想在调试器的编译器代码中看到 square-peg 应用于 insert-peg 运行。 (也许我错过了一个断点,或者找错了地方)。

假设:

我的问题是:如何在 Clojure 编译器中调试参数对我的函数的应用?

诀窍是函数 InvokeExpr(...) in Compiler.java

特别是 VarExpr 部分。