diff options
| author | 2025-07-12 17:06:38 +0200 | |
|---|---|---|
| committer | 2025-07-13 16:31:12 +0200 | |
| commit | 2af3f21d6965703a337ab694da834e9cc395b420 (patch) | |
| tree | c12cd92e31dbfa9cd24f828d91bb0214470c8c0c /src | |
| parent | Clarify :fresh usage in import (diff) | |
Validate optional args to import
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot/boot.janet | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 8f2c7041..61f6fd63 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -3185,8 +3185,13 @@ value to bypass the module cache. Use `:only [foo bar baz]` to only import select bindings into the current environment.`` [path & args] + (assertf (even? (length args)) "args should have even length: %n" args) (def ps (partition 2 args)) - (def argm (mapcat (fn [[k v]] [k (case k :as (string v) :only ~(quote ,v) v)]) ps)) + (def argm + (mapcat (fn [[k v]] + (assertf (keyword? k) "expected keyword, got %s: %n" (type k) k) + [k (case k :as (string v) :only ~(quote ,v) v)]) + ps)) (tuple import* (string path) ;argm)) (defmacro use |
