Refactor inlining logic into try_inline function
This commit extracts the logic for inlining function calls into a new private method, `try_inline`. This improves code organization and reduces duplication in the `Optimizer`'s `visit_node` method. The extracted method handles the preparation of substitutions and the recursive visiting of the inlined node. It also ensures that the substitution map state is correctly synchronized back to the calling context.
This commit is contained in:
+4
-2
@@ -5,6 +5,8 @@
|
||||
|
||||
(macro printx [s] `(fn [x] (print ~s x)))
|
||||
|
||||
(pipe [(.close src)] (printx "close="))
|
||||
(pipe [(pipe [(.close src)] (SMA 20))] (printx "sma="))
|
||||
(pipe src print)
|
||||
(pipe [(pipe [(.close src)] (SMA 20))] (printx "sma20="))
|
||||
(pipe [(pipe [(.close src)] (SMA 5))] (printx "sma5="))
|
||||
(pipe [(pipe [(.close src)] (SMA 100))] (printx "sma100="))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user