Skip to content

Commit 4190a3e

Browse files
committed
fix runtime errors reported by telemetry
1 parent 87288ef commit 4190a3e

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

script/vm/function.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ end
148148
---@return integer min
149149
---@return number max
150150
function vm.countReturnsOfCall(func, args, mark)
151-
local funcs = vm.getMatchedFunctions(func, args)
151+
local funcs = vm.getMatchedFunctions(func, args, mark)
152152
---@type integer?
153153
local min
154154
---@type number?
@@ -197,8 +197,9 @@ end
197197

198198
---@param func parser.object
199199
---@param args parser.object[]?
200+
---@param mark? table
200201
---@return parser.object[]
201-
function vm.getMatchedFunctions(func, args)
202+
function vm.getMatchedFunctions(func, args, mark)
202203
local funcs = {}
203204
local node = vm.compileNode(func)
204205
for n in node:eachObject() do
@@ -211,7 +212,7 @@ function vm.getMatchedFunctions(func, args)
211212
return funcs
212213
end
213214

214-
local amin, amax = vm.countList(args)
215+
local amin, amax = vm.countList(args, mark)
215216

216217
local matched = {}
217218
for _, n in ipairs(funcs) do

script/workspace/require-path.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ function mt:findUrisByRequireName(suri, name)
169169
local searcherMap = {}
170170

171171
for _, searcher in ipairs(searchers) do
172-
local fspath = searcher:gsub('%?', path)
173-
if self.scp.uri then
174-
local fullPath = workspace.getAbsolutePath(self.scp.uri, fspath)
172+
local fspath = searcher:gsub('%?', path:gsub('%%', '%%%%'))
173+
local fullPath = workspace.getAbsolutePath(self.scp.uri, fspath)
174+
if fullPath then
175175
local fullUri = furi.encode(fullPath)
176176
if files.exists(fullUri)
177177
and fullUri ~= suri then

script/workspace/workspace.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,15 @@ function m.normalize(path)
404404
return path
405405
end
406406

407-
---@param folderUri uri
407+
---@param folderUri? uri
408408
---@param path string
409-
---@return string
409+
---@return string?
410410
function m.getAbsolutePath(folderUri, path)
411411
path = m.normalize(path)
412412
if fs.path(path):is_relative() then
413+
if not folderUri then
414+
return nil
415+
end
413416
local folderPath = furi.decode(folderUri)
414417
path = m.normalize(folderPath .. '/' .. path)
415418
end

0 commit comments

Comments
 (0)