ws-cleanup-types: containers, ops: type the tables and locals the solver cannot infer

This commit is contained in:
4DBug committed 2026-10-31 10:46:15 -05:00
1 parent f209801579
commit cfe325dcf8
12 files changed
+37 -32

No files matched your search

+9 -4
View File
@@ -18,8 +18,13 @@ local Mux = require("@formats/containers/Ogg/Mux")
local AudioWrap = {}
local function allPackets(dmx: any, track: Types.Track): { Types.Packet }
local out = {}
type PacketSource = {
count: ((self: any, track: number) -> number)?,
get: ((self: any, track: number, k: number) -> Types.Packet?)?,
}
local function allPackets(dmx: PacketSource, track: Types.Track): { Types.Packet }
local out: { Types.Packet } = {}
local n = if dmx.count then dmx:count(track.id) else 0
if n > 0 and dmx.get then
for k = 1, n do
@@ -437,11 +442,11 @@ function AudioWrap.wrap(dmx: any, track: Types.Track): (buffer?, string?, Err.Er
return granule
end
local mb = 0
while 2 ^ mb < #modes do
while 2 ^ mb < #(modes :: { boolean }) do
mb += 1
end
local m = if mb > 0 and buffer.len(d) * 8 > mb then bits(d, 1, mb) else 0
local cur = sizes[if modes[m + 1] then 2 else 1]
local cur = sizes[if (modes :: { boolean })[m + 1] then 2 else 1]
if prev then
granule += (prev + cur) // 4
end