diff options
-rw-r--r-- | script/vm/function.lua | 7 | ||||
-rw-r--r-- | script/workspace/require-path.lua | 6 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 7 |
3 files changed, 12 insertions, 8 deletions
diff --git a/script/vm/function.lua b/script/vm/function.lua index 0e04408c..f64b2262 100644 --- a/script/vm/function.lua +++ b/script/vm/function.lua @@ -148,7 +148,7 @@ end ---@return integer min ---@return number max function vm.countReturnsOfCall(func, args, mark) - local funcs = vm.getMatchedFunctions(func, args) + local funcs = vm.getMatchedFunctions(func, args, mark) ---@type integer? local min ---@type number? @@ -197,8 +197,9 @@ end ---@param func parser.object ---@param args parser.object[]? +---@param mark? table ---@return parser.object[] -function vm.getMatchedFunctions(func, args) +function vm.getMatchedFunctions(func, args, mark) local funcs = {} local node = vm.compileNode(func) for n in node:eachObject() do @@ -211,7 +212,7 @@ function vm.getMatchedFunctions(func, args) return funcs end - local amin, amax = vm.countList(args) + local amin, amax = vm.countList(args, mark) local matched = {} for _, n in ipairs(funcs) do diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index 204a22a6..8048f8ef 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -169,9 +169,9 @@ function mt:findUrisByRequireName(suri, name) local searcherMap = {} for _, searcher in ipairs(searchers) do - local fspath = searcher:gsub('%?', path) - if self.scp.uri then - local fullPath = workspace.getAbsolutePath(self.scp.uri, fspath) + local fspath = searcher:gsub('%?', path:gsub('%%', '%%%%')) + local fullPath = workspace.getAbsolutePath(self.scp.uri, fspath) + if fullPath then local fullUri = furi.encode(fullPath) if files.exists(fullUri) and fullUri ~= suri then diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 973ae9ec..e69a4be4 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -404,12 +404,15 @@ function m.normalize(path) return path end ----@param folderUri uri +---@param folderUri? uri ---@param path string ----@return string +---@return string? function m.getAbsolutePath(folderUri, path) path = m.normalize(path) if fs.path(path):is_relative() then + if not folderUri then + return nil + end local folderPath = furi.decode(folderUri) path = m.normalize(folderPath .. '/' .. path) end |