Skip to content

Commit

Permalink
core: Allow :all on one line require
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jul 4, 2024
1 parent 1a40afa commit 64af767
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/src/yamlscript/transformers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@
[(conj args AS alias) (drop 2 rhs)]
[args rhs])
args (if (seq rhs)
(if (every? :Sym rhs)
(conj args REFER (Vec rhs))
(die "Invalid 'require' arguments"))
(cond
(every? :Sym rhs) (conj args REFER (Vec rhs))
(= rhs [{:Key :all}]) (conj args REFER (first rhs))
:else (die "Invalid 'require' arguments"))
args)]
args))

Expand Down
8 changes: 8 additions & 0 deletions core/test/transformer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
'[foo.fff :refer :all])
- name: 'require ns: :all'
yamlscript: |
!yamlscript/v0
require foo::bar: :all
clojure: |
(require '[foo.bar :refer :all])
- name: Anonymous function with name
yamlscript: |
!yamlscript/v0
Expand Down

0 comments on commit 64af767

Please sign in to comment.