Skip to content

Commit

Permalink
target
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Jan 21, 2025
1 parent b195453 commit b41c5be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/darkleaf/di/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,10 @@
:role :arg}))
own-registry (zipmap (cons f-key arg-keys)
(cons f-factory arg-factories))
target-factory (registry target)]
target-factory (some-> (registry target)
(u/update-description assoc
::update-key {:target target
:role :target}))]
(when (nil? target-factory)
(throw (ex-info (str "Can't update non-existent key " target)
{:type ::non-existent-key
Expand Down
6 changes: 4 additions & 2 deletions test/darkleaf/di/tutorial/x_inspect_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@
:f `a+di-update-key#0-f
:args [`a+di-update-key#0-arg#0]}}
{:key `a+di-update-key#0-target
:description {::di/kind :trivial
:object :obj}}
:description {::di/kind :trivial
:object :obj
::di/update-key {:target `a
:role :target}}}
{:key `a+di-update-key#0-f
:description {::di/kind :trivial
:object str
Expand Down

0 comments on commit b41c5be

Please sign in to comment.