fix fennel-ls#81
This commit is contained in:
parent
5c0894d57d
commit
cd9821cd80
@ -24,6 +24,9 @@ identifiers are declared / referenced in which places."
|
||||
(icollect [k (pairs compiler-env)] k)))
|
||||
(set compiler-env._G._FENNEL_LS true)
|
||||
|
||||
;; FIXME: this is a workaround for https://dev.fennel-lang.org/ticket/51#ticket
|
||||
(set-forcibly! compiler-env (collect [k v ((. (getmetatable compiler-env) :__pairs) compiler-env)] k v))
|
||||
|
||||
(local nil* (sym :nil))
|
||||
|
||||
(fn scope? [candidate]
|
||||
|
||||
@ -274,7 +274,7 @@
|
||||
|
||||
(fn test-compiler-env []
|
||||
(check ";; fennel-ls: macro-file\n("
|
||||
[:sym :sym? :list :quote :icollect :math]
|
||||
[:sym :sym? :list :quote :icollect :math :ipairs]
|
||||
[:os])
|
||||
;; TODO #73
|
||||
; (check "(macro foo [] (|"
|
||||
|
||||
@ -168,12 +168,32 @@
|
||||
[{:message "unknown field: math.atan2"}]
|
||||
{:lua-version "lua5.3"}))
|
||||
|
||||
(fn test-macro-environment []
|
||||
(check {:main.fnl "(macro not-any [subject & vals]
|
||||
\"Returns `true` if `subject` is not equal to any of the remaining values.\"
|
||||
(let [conds# (icollect [_ v# (ipairs vals)]
|
||||
`(not= ,subject ,v#))]
|
||||
`(and ,(unpack conds#))))"}
|
||||
[]
|
||||
[{}])
|
||||
(check {:main.fnl ";; fennel-ls: macro-file
|
||||
(fn not-any [subject & vals]
|
||||
\"Returns `true` if `subject` is not equal to any of the remaining values.\"
|
||||
(let [conds# (icollect [_ v# (ipairs vals)]
|
||||
`(not= ,subject ,v#))]
|
||||
`(and ,(unpack conds#))))
|
||||
{: not-any}"}
|
||||
[]
|
||||
[{}])
|
||||
nil)
|
||||
|
||||
(fn test-warnings []
|
||||
(check "(print \"hello\"table)"
|
||||
[{:message "expected whitespace before token"}]
|
||||
[]))
|
||||
|
||||
{: test-lua-versions
|
||||
: test-macro-environment
|
||||
: test-compile-error
|
||||
: test-parse-error
|
||||
: test-macro-error
|
||||
|
||||
Loading…
Reference in New Issue
Block a user