ws-cleanup: merge ws/cleanup-types (type annotations)
This commit is contained in:
commit
4478332a61
115 files changed
+583
-515
No files matched your search
@@ -206,7 +206,7 @@ function Decode.decode(s: string, opts: Options?): (any, any, number?)
|
||||
|
||||
-- a (dotted) key: { parts }, next | nil
|
||||
local function key(i: number): ({ string }?, number)
|
||||
local keys = {}
|
||||
local keys: { string } = {}
|
||||
while true do
|
||||
i = ws(i)
|
||||
local c = byte(s, i)
|
||||
@@ -232,7 +232,7 @@ function Decode.decode(s: string, opts: Options?): (any, any, number?)
|
||||
if k == nil then
|
||||
return nil, 0
|
||||
end
|
||||
table.insert(keys, k)
|
||||
table.insert(keys, k :: string)
|
||||
i = ws(i)
|
||||
if byte(s, i) == 46 then
|
||||
i += 1
|
||||
@@ -305,7 +305,7 @@ function Decode.decode(s: string, opts: Options?): (any, any, number?)
|
||||
end
|
||||
return if sign == "-" then -v else v, nexti
|
||||
end
|
||||
local text = sign .. digits
|
||||
local text: string = (sign :: string) .. digits
|
||||
local frac, r2 = match(rest :: string, "^%.([%d_]*)(.*)$")
|
||||
if frac then
|
||||
if not digitsOk(frac, "%d") then
|
||||
@@ -316,10 +316,10 @@ function Decode.decode(s: string, opts: Options?): (any, any, number?)
|
||||
end
|
||||
if rest ~= "" then
|
||||
local es, ed = match(rest :: string, "^[eE]([%+%-]?)([%d_]*)$")
|
||||
if not es or not digitsOk(ed, "%d") then
|
||||
if not es or not digitsOk(ed :: string, "%d") then
|
||||
return fail("bad float", i), 0
|
||||
end
|
||||
text ..= "e" .. es .. gsub(ed, "_", "")
|
||||
text ..= "e" .. es .. gsub(ed :: string, "_", "")
|
||||
end
|
||||
local v = tonumber(text)
|
||||
if v == nil then
|
||||
|
||||
Reference in new issue
Block a user