replace pairs with ipairs where necessary
This commit is contained in:
@ -125,7 +125,7 @@ function M.synctree(tree, cb)
|
||||
end
|
||||
end
|
||||
|
||||
for _, package in pairs(tree) do
|
||||
for _, package in ipairs(tree) do
|
||||
local co = coroutine.create(function()
|
||||
-- if the package provided prefers a local source then use the local
|
||||
-- source instead of the git repository
|
||||
@ -170,7 +170,7 @@ return function(opts)
|
||||
M.registertree(opts)
|
||||
|
||||
-- sort package dependencies
|
||||
for _, package in pairs(packager.get_packages()) do
|
||||
for _, package in ipairs(packager.get_packages()) do
|
||||
table.sort(package.requirements, comp)
|
||||
table.sort(package.dependents, comp)
|
||||
end
|
||||
@ -198,7 +198,7 @@ return function(opts)
|
||||
|
||||
-- get all package that need syncing
|
||||
local targets = {}
|
||||
for _, package in pairs(packager.get_packages()) do
|
||||
for _, package in ipairs(packager.get_packages()) do
|
||||
if shouldsync(package) then
|
||||
table.insert(targets, package)
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ function fs:clean(package)
|
||||
end
|
||||
|
||||
-- keep packages that still exist
|
||||
for _, pkg in pairs(package.get_packages()) do
|
||||
for _, pkg in ipairs(package.get_packages()) do
|
||||
queue[pkg.name] = nil
|
||||
end
|
||||
|
||||
|
@ -315,7 +315,7 @@ function package:new(spec, overrides)
|
||||
if spec.reqs then
|
||||
---it is the correct type as asserted in check_spec()
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
for _, req in pairs(spec.reqs) do
|
||||
for _, req in ipairs(spec.reqs) do
|
||||
local pkg = package:new(req)
|
||||
if type(pkg) == "table" then
|
||||
o:link_dependency(pkg, o)
|
||||
@ -327,7 +327,7 @@ function package:new(spec, overrides)
|
||||
if spec.deps then
|
||||
---it is the correct type as asserted in check_spec()
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
for _, dep in pairs(spec.deps) do
|
||||
for _, dep in ipairs(spec.deps) do
|
||||
local pkg = package:new(dep)
|
||||
if not pkg then
|
||||
return false
|
||||
@ -425,7 +425,7 @@ function package:ensureadded(force)
|
||||
---@param pkg package
|
||||
local function loadpkg(pkg)
|
||||
-- make sure to load the dependencies first
|
||||
for _, p in pairs(pkg.requirements) do
|
||||
for _, p in ipairs(pkg.requirements) do
|
||||
if not p.loaded then
|
||||
p:ensureadded(true)
|
||||
end
|
||||
@ -506,7 +506,7 @@ function package:loadtree(force)
|
||||
|
||||
-- if the package isn't lazy check that it's requirements are loaded
|
||||
if not self.lazy then
|
||||
for _, requirement in pairs(self.requirements) do
|
||||
for _, requirement in ipairs(self.requirements) do
|
||||
if not requirement.loaded and not requirement.lazy then
|
||||
return false
|
||||
end
|
||||
@ -526,7 +526,7 @@ function package:loadtree(force)
|
||||
self.subtree_loaded = true
|
||||
|
||||
-- make sure the dependants are loaded
|
||||
for _, dependant in pairs(self.dependents) do
|
||||
for _, dependant in ipairs(self.dependents) do
|
||||
self.subtree_loaded = dependant:loadtree(force) and self.subtree_loaded
|
||||
end
|
||||
|
||||
@ -536,12 +536,12 @@ end
|
||||
--- unconfigure a packages tree
|
||||
function package:unconfiguretree()
|
||||
-- unconfigure requirements
|
||||
for _, requirement in pairs(self.requirements) do
|
||||
for _, requirement in ipairs(self.requirements) do
|
||||
requirement.subtree_loaded = false
|
||||
end
|
||||
|
||||
-- unconfigure dependents
|
||||
for _, dependant in pairs(self.dependents) do
|
||||
for _, dependant in ipairs(self.dependents) do
|
||||
dependant.loaded = false
|
||||
dependant.added = false
|
||||
dependant.configured = false
|
||||
@ -602,7 +602,7 @@ function package.findcycle(pkgs)
|
||||
end
|
||||
|
||||
-- actually check the cycle
|
||||
for _, pkg in pairs(pkgs) do
|
||||
for _, pkg in ipairs(pkgs) do
|
||||
if not indexes[package.id] then
|
||||
local cycle = connect(pkg)
|
||||
if cycle then
|
||||
|
Reference in New Issue
Block a user