mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
Fix flycheck when using the use
macro.
Flycheck originally expected `use` to have the same arguments as `import`, but this is not the case.
This commit is contained in:
parent
057ba8a4e1
commit
41f8be2c53
@ -2600,7 +2600,9 @@
|
|||||||
'def is-safe-def 'var is-safe-def 'def- is-safe-def 'var- is-safe-def
|
'def is-safe-def 'var is-safe-def 'def- is-safe-def 'var- is-safe-def
|
||||||
'defglobal is-safe-def 'varglobal is-safe-def})
|
'defglobal is-safe-def 'varglobal is-safe-def})
|
||||||
|
|
||||||
(def- importers {'import true 'import* true 'use true 'dofile true 'require true})
|
(def- importers {'import true 'import* true 'dofile true 'require true})
|
||||||
|
(defn- use-2 [evaluator args]
|
||||||
|
(each a args (import* (string a) :prefix "" :evaluator evaluator)))
|
||||||
|
|
||||||
# conditional compilation for reduced os
|
# conditional compilation for reduced os
|
||||||
(def- getenv-alias (if-let [entry (in _env 'os/getenv)] (entry :value) (fn [&])))
|
(def- getenv-alias (if-let [entry (in _env 'os/getenv)] (entry :value) (fn [&])))
|
||||||
@ -2688,6 +2690,9 @@
|
|||||||
# Always safe form
|
# Always safe form
|
||||||
safe-check
|
safe-check
|
||||||
(thunk)
|
(thunk)
|
||||||
|
# Use
|
||||||
|
(= 'use head)
|
||||||
|
(use-2 evaluator (tuple/slice source 1))
|
||||||
# Import-like form
|
# Import-like form
|
||||||
(importers head)
|
(importers head)
|
||||||
(do
|
(do
|
||||||
@ -2738,6 +2743,7 @@
|
|||||||
(put _env 'is-safe-def nil)
|
(put _env 'is-safe-def nil)
|
||||||
(put _env 'safe-forms nil)
|
(put _env 'safe-forms nil)
|
||||||
(put _env 'importers nil)
|
(put _env 'importers nil)
|
||||||
|
(put _env 'use-2 nil)
|
||||||
(put _env 'getenv-alias nil)
|
(put _env 'getenv-alias nil)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
Loading…
Reference in New Issue
Block a user