mirror of
https://github.com/janet-lang/janet
synced 2026-01-13 18:32:41 +00:00
Make varfn correctly handle verbose metadata.
The macro would previously choke on `(varfn abc {:abc 123} ...)` due
to mishandling of structs and tables as metadata. This caused issues
when running `janet -d` with spork.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased - ???
|
||||
- Use color in script output if color is being used in REPL output.
|
||||
- Fix `varfn` macros handling of extra metadata.
|
||||
- Add linting for unused bindings.
|
||||
- Add `janet_optuinteger` and `janet_optuinteger64` to the C API.
|
||||
- Add `cms` combinator to PEGs.
|
||||
|
||||
@@ -2403,6 +2403,7 @@
|
||||
(cond
|
||||
(keyword? m) (put metadata m true)
|
||||
(string? m) (put metadata :doc m)
|
||||
(dictionary? m) (merge-into metadata m)
|
||||
(error (string "invalid metadata " m))))
|
||||
(with-syms [entry old-entry f]
|
||||
~(let [,old-entry (,dyn ',name)]
|
||||
@@ -4682,6 +4683,11 @@
|
||||
(setdyn *err-color* (if colorize true))
|
||||
(setdyn *doc-color* (if colorize true)))
|
||||
|
||||
(defn- getstdin [prompt buf _]
|
||||
(file/write stdout prompt)
|
||||
(file/flush stdout)
|
||||
(file/read stdin :line buf))
|
||||
|
||||
(defn cli-main
|
||||
`Entrance for the Janet CLI tool. Call this function with the command line
|
||||
arguments as an array or tuple of strings to invoke the CLI interface.`
|
||||
@@ -4705,10 +4711,10 @@
|
||||
(module/add-syspath (get paths i)))
|
||||
(setdyn *syspath* (first paths)))
|
||||
(if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn *profilepath* jprofile))
|
||||
(when (and
|
||||
(not (getenv-alias "NO_COLOR"))
|
||||
(os/isatty stdout))
|
||||
(apply-color true))
|
||||
(apply-color
|
||||
(and
|
||||
(not (getenv-alias "NO_COLOR"))
|
||||
(os/isatty stdout)))
|
||||
|
||||
(defn- get-lint-level
|
||||
[i]
|
||||
@@ -4861,10 +4867,6 @@
|
||||
(when-let [custom-prompt (get env *repl-prompt*)] (break (custom-prompt p)))
|
||||
(def [line] (parser/where p))
|
||||
(string "repl:" line ":" (parser/state p :delimiters) "> "))
|
||||
(defn getstdin [prompt buf _]
|
||||
(file/write stdout prompt)
|
||||
(file/flush stdout)
|
||||
(file/read stdin :line buf))
|
||||
(def getter (if raw-stdin getstdin getline))
|
||||
(defn getchunk [buf p]
|
||||
(getter (getprompt p) buf env))
|
||||
|
||||
Reference in New Issue
Block a user