Skip to content

Commit

Permalink
Reflexivity
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeoffrey committed Dec 19, 2023
1 parent 784635a commit b59bc32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hyperfiddle/electric/impl/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

(defn var-name [ast]
(if-let [var (:var ast)]
(.toSymbol var)
(.toSymbol ^clojure.lang.Var var)
(or (:name ast)
(:form ast))))

Expand Down
6 changes: 5 additions & 1 deletion src/hyperfiddle/electric/impl/runtime.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@
(tests
(remove-dep-nodes (ir/input [(ir/node 'x) (ir/output ir/nop)])) := (ir/input [(ir/output ir/nop)]))

(defn tag-sym [sym jvm-hint js-hint]
#?(:clj (when jvm-hint (vary-meta sym assoc :tag jvm-hint))
:cljs (when js-hint (vary-meta sym assoc :tag js-hint))))

(defn compile [prefix inst e]
(let [nodes (find-nodes inst)
inst (remove-dep-nodes inst)
Expand All @@ -924,7 +928,7 @@
`(doto (object-array ~(count free))
~@(eduction (map-indexed (fn [i f] (list `aset i (env f)))) free)))
emit-exprs (fn [exprs]
(list `fn [frame vars (sym prefix 'env)]
(list `fn [frame vars (tag-sym (sym prefix 'env) "[Ljava.lang.Object;" nil)]
(list `let
(into [] (comp (map-indexed (fn [i expr] [(expr-at i) expr])) cat) (pop exprs))
(peek exprs))))
Expand Down

0 comments on commit b59bc32

Please sign in to comment.