Strings beginning with digits can't be rewritten as syms.
Also fix a self-lint.
This commit is contained in:
parent
25196aeabf
commit
3979ab4c3c
@ -73,8 +73,7 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
|
|||||||
(. document.fields (. stack (length stack))))
|
(. document.fields (. stack (length stack))))
|
||||||
(search-document server (. document.fields (table.remove stack)) stack opts)
|
(search-document server (. document.fields (table.remove stack)) stack opts)
|
||||||
(not document.fields)
|
(not document.fields)
|
||||||
(do
|
(set opts.searched-through-require-indeterminate true)))
|
||||||
(set opts.searched-through-require-indeterminate true))))
|
|
||||||
|
|
||||||
(λ search-val [server file ?ast stack opts]
|
(λ search-val [server file ?ast stack opts]
|
||||||
"searches for the definition of the ast, adjusted to 1 value"
|
"searches for the definition of the ast, adjusted to 1 value"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ the `file.diagnostics` field, filling it with diagnostics."
|
|||||||
item))
|
item))
|
||||||
|
|
||||||
(fn could-be-rewritten-as-sym? [str]
|
(fn could-be-rewritten-as-sym? [str]
|
||||||
(and (= :string (type str))
|
(and (= :string (type str)) (not (str:find "^%d"))
|
||||||
(not (str:find "[^!$%*+/0-9<=>?A-Z\\^_a-z|\128-\255-]"))))
|
(not (str:find "[^!$%*+/0-9<=>?A-Z\\^_a-z|\128-\255-]"))))
|
||||||
|
|
||||||
(λ unused-definition [server file symbol definition]
|
(λ unused-definition [server file symbol definition]
|
||||||
|
|||||||
@ -179,7 +179,7 @@
|
|||||||
:end {:character 32 :line 0}}}])
|
:end {:character 32 :line 0}}}])
|
||||||
;; Lint only triggers on keys that can be written as a sym
|
;; Lint only triggers on keys that can be written as a sym
|
||||||
(check "(local tbl {}) (tset tbl \"hello-world\" 249)" [{:code 309}])
|
(check "(local tbl {}) (tset tbl \"hello-world\" 249)" [{:code 309}])
|
||||||
(check "(local tbl {}) (tset tbl \"01234567\" 249)" [{:code 309}])
|
(assert-ok "(local tbl {}) (tset tbl \"01234567\" 249)")
|
||||||
(assert-ok "(local tbl {}) (tset tbl \"hello world\" 1)")
|
(assert-ok "(local tbl {}) (tset tbl \"hello world\" 1)")
|
||||||
(assert-ok "(local tbl {}) (tset tbl \"0123.4567\" 1)")
|
(assert-ok "(local tbl {}) (tset tbl \"0123.4567\" 1)")
|
||||||
nil)
|
nil)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user