File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 651651(defn- stop-fn [variable]
652652 (-> variable meta (::stop (fn no-op [_]))))
653653
654- (defn- validate-obj! [obj variable]
655- (when (nil? obj)
656- (throw (ex-info " A component fn must not return nil"
657- {:type ::nil-return
658- :variable variable}))))
659-
660654(defn- var->0-component [variable]
661655 (let [stop (stop-fn variable)]
662656 (reify p/Factory
663657 (dependencies [_])
664658 (build [_ _ add-stop]
665- (let [obj (variable )]
666- (validate-obj! obj variable)
659+ (let [obj (?? (variable ) ::nil )]
667660 (add-stop #(stop obj))
668661 obj))
669662 (description [_]
676669 (dependencies [_]
677670 deps)
678671 (build [_ deps add-stop]
679- (let [obj (variable deps)]
680- (validate-obj! obj variable)
672+ (let [obj (?? (variable deps) ::nil )]
681673 (add-stop #(stop obj))
682674 obj))
683675 (description [_]
Original file line number Diff line number Diff line change 1515 nil )
1616
1717(t/deftest nil-component-0-arity-test
18- (let [ex ( catch-some ( di/start `nil-component-0-arity) )]
19- (t/is (= ::di/nil-return ( -> ex ex-cause ex-data :type ) ))))
18+ (let [root ( di/start `nil-component-0-arity)]
19+ (t/is (= ::di/nil @root ))))
2020
2121(t/deftest nil-component-1-arity-test
22- (let [ex ( catch-some ( di/start `nil-component-1-arity) )]
23- (t/is (= ::di/nil-return ( -> ex ex-cause ex-data :type ) ))))
22+ (let [root ( di/start `nil-component-1-arity)]
23+ (t/is (= ::di/nil @root ))))
2424
2525
2626(defn component-2-arity
You can’t perform that action at this time.
0 commit comments