diff options
-rw-r--r-- | ccwl/ccwl.scm | 12 | ||||
-rw-r--r-- | tests/ccwl.scm | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 00d503f..b158947 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -412,12 +412,12 @@ object or a <cwl-workflow> object." object) described by syntax X. If such a ccwl function is not defined, return #f." ;; TODO: What if function object is defined in lexical scope? - (let ((var (module-variable (current-module) - (syntax->datum x)))) - (and var - (or (command? (variable-ref var)) - (cwl-workflow? (variable-ref var))) - (variable-ref var)))) + (let ((result (false-if-exception + (eval (syntax->datum x) + (interaction-environment))))) + (and (or (command? result) + (cwl-workflow? result)) + result))) (define (collect-steps x input-keys) "Traverse ccwl workflow body X and return two values---a list of diff --git a/tests/ccwl.scm b/tests/ccwl.scm index 9aa00f3..2207200 100644 --- a/tests/ccwl.scm +++ b/tests/ccwl.scm @@ -139,4 +139,10 @@ (workflow () (print-with-default))) +(test-assert "allow steps with expressions that evaluate to commands" + (workflow ((message #:type string)) + ((and #t print) + (print) + #:message message))) + (test-end "ccwl") |