WIP: awesomerc.tl
should work #85
|
@ -78,24 +78,22 @@ end
|
|||
|
||||
local function find_module(dag: Dag, module_path: string): Node
|
||||
local current_path = ""
|
||||
local current: Node = { children = dag.modules }
|
||||
for breadcrumb in module_path:gmatch("([^%.]+)") do
|
||||
current_path = current_path == "" and breadcrumb or current_path .. "." .. breadcrumb
|
||||
local current: Node = nil
|
||||
|
||||
if current_path == module_path then
|
||||
return current
|
||||
end
|
||||
|
||||
for _, n in ipairs(dag.modules) do
|
||||
if n.module_path == current_path then
|
||||
current = n
|
||||
break
|
||||
for _, child in ipairs(current.children) do
|
||||
if child.module_path == module_path then
|
||||
return child
|
||||
end
|
||||
if child.module_path == current_path then
|
||||
current = child
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
if current == nil then
|
||||
return nil
|
||||
end
|
||||
break
|
||||
::continue::
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
|
@ -86,8 +86,23 @@ function Module_Dependencies.visit(node: Node, mod: Node, d: Dag)
|
|||
if type_name == mod.name then
|
||||
goto continue
|
||||
end
|
||||
if utils.has_item({
|
||||
"any",
|
||||
"number",
|
||||
"integer",
|
||||
"string",
|
||||
"boolean",
|
||||
"function",
|
||||
"nil",
|
||||
"table",
|
||||
}, type_name) then
|
||||
goto continue
|
||||
end
|
||||
if capi_class[type_name] then
|
||||
goto continue
|
||||
end
|
||||
|
||||
local dependency = dag.find_module(d, type_name) or dag.find_module(d, utils.lowercase(type_name)) or capi_class[type_name]
|
||||
local dependency = dag.find_module(d, type_name)
|
||||
if dependency then
|
||||
if dependency.name ~= mod.name then
|
||||
mod.dependencies[dependency.name] = dependency.module_path
|
||||
|
|
Loading…
Reference in New Issue