1
0
mirror of https://github.com/janet-lang/janet synced 2025-06-26 23:22:51 +00:00

Update dofile function signature.

This commit is contained in:
Calvin Rose 2022-06-12 18:03:23 -05:00
parent 1905437abe
commit ad1b50d1f5

View File

@ -2803,14 +2803,7 @@
:source, :evaluator, :read, and :parser are passed through to the underlying :source, :evaluator, :read, and :parser are passed through to the underlying
`run-context` call. If `exit` is true, any top level errors will trigger a `run-context` call. If `exit` is true, any top level errors will trigger a
call to `(os/exit 1)` after printing the error.`` call to `(os/exit 1)` after printing the error.``
[path &keys [path &named exit env source expander evaluator read parser]
{:exit exit
:env env
:source src
:expander expander
:evaluator evaluator
:read read
:parser parser}]
(def f (case (type path) (def f (case (type path)
:core/file path :core/file path
:core/stream path :core/stream path
@ -2818,7 +2811,7 @@
(def path-is-file (= f path)) (def path-is-file (= f path))
(default env (make-env)) (default env (make-env))
(def spath (string path)) (def spath (string path))
(put env :source (or src (if-not path-is-file spath path))) (put env :source (or source (if-not path-is-file spath path)))
(var exit-error nil) (var exit-error nil)
(var exit-fiber nil) (var exit-fiber nil)
(defn chunks [buf _] (:read f 4096 buf)) (defn chunks [buf _] (:read f 4096 buf))
@ -2864,7 +2857,7 @@
:expander expander :expander expander
:read read :read read
:parser parser :parser parser
:source (or src (if path-is-file :<anonymous> spath))})) :source (or source (if path-is-file :<anonymous> spath))}))
(if-not path-is-file (:close f)) (if-not path-is-file (:close f))
(when exit-error (when exit-error
(if exit-fiber (if exit-fiber