diff options
| author | Andrey Listopadov <andreyorst@gmail.com> | 2021-07-23 21:41:22 +0300 |
|---|---|---|
| committer | Andrey Listopadov <andreyorst@gmail.com> | 2021-07-23 21:41:22 +0300 |
| commit | 5cd4100a4e9e7b7cf77b21f2759f6401cd9a06d9 (patch) | |
| tree | 684fed91c5f78fff1c0c242306541f4c5efe71c4 /init-macros.fnl | |
| parent | 859cf1388770f65d31002d3667977d6760c2e092 (diff) | |
fix: don't generate mulitarity arglist doc for single-arity functions
Diffstat (limited to 'init-macros.fnl')
| -rw-r--r-- | init-macros.fnl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/init-macros.fnl b/init-macros.fnl index 0b5fe65..a9762c8 100644 --- a/init-macros.fnl +++ b/init-macros.fnl @@ -224,11 +224,11 @@ this stuff will only work if you use `require-macros' instead of (string.format "%q" data) (tostring data)))) -(fn gen-arglist-doc [args method?] +(fn gen-arglist-doc [args method? multi?] (if (list? (. args 1)) (let [arglist []] (each [_ v (ipairs args)] - (let [arglist-doc (gen-arglist-doc v method?)] + (let [arglist-doc (gen-arglist-doc v method? (list? (. args 2)))] (when (next arglist-doc) (table.insert arglist (table.concat arglist-doc " "))))) (when (and (> (length (table.concat arglist " ")) 60) @@ -239,18 +239,20 @@ this stuff will only work if you use `require-macros' instead of (sequence? (. args 1)) (let [arglist [] + open (if multi? "([" "[") + close (if multi? "])" "]") args (if method? [(sym :self) (table.unpack (. args 1))] (. args 1)) len (length args)] (if (= len 0) - (table.insert arglist "([])") + (table.insert arglist (.. open close)) (each [i v (ipairs args)] (table.insert arglist (match i - (1 ? (= len 1)) (.. "([" (deep-tostring v) "])") - 1 (.. "([" (deep-tostring v)) - len (.. (deep-tostring v) "])") + (1 ? (= len 1)) (.. open (deep-tostring v) close) + 1 (.. open (deep-tostring v)) + len (.. (deep-tostring v) close) _ (deep-tostring v))))) arglist))) |