summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/client.lua2
-rw-r--r--script/library.lua6
-rw-r--r--script/vm/infer.lua15
3 files changed, 11 insertions, 12 deletions
diff --git a/script/client.lua b/script/client.lua
index aa24ae24..7432e60b 100644
--- a/script/client.lua
+++ b/script/client.lua
@@ -256,7 +256,7 @@ local function tryModifyRC(uri, finalChanges, create)
if not path then
return false
end
- path = fs.exists(path) and path or workspace.getAbsolutePath(uri, '.luarc.json')
+ path = fs.exists(fs.path(path)) and path or workspace.getAbsolutePath(uri, '.luarc.json')
if not path then
return false
end
diff --git a/script/library.lua b/script/library.lua
index d0294650..d2d45af1 100644
--- a/script/library.lua
+++ b/script/library.lua
@@ -209,7 +209,7 @@ local function initBuiltIn(uri)
local langID = lang.id
local version = config.get(uri, 'Lua.runtime.version')
local encoding = config.get(uri, 'Lua.runtime.fileEncoding')
- ---@type fspath
+ ---@type fs.path
local metaPath = fs.path(METAPATH) / config.get(uri, 'Lua.runtime.meta'):gsub('%$%{(.-)%}', {
version = version,
language = langID,
@@ -244,7 +244,7 @@ local function initBuiltIn(uri)
goto CONTINUE
end
libName = libName .. '.lua'
- ---@type fspath
+ ---@type fs.path
local libPath = templateDir / libName
local metaDoc = compileSingleMetaDoc(uri, fsu.loadFile(libPath), metaLang, status)
if metaDoc then
@@ -262,7 +262,7 @@ local function initBuiltIn(uri)
end
end
----@param libraryDir fspath
+---@param libraryDir fs.path
local function loadSingle3rdConfig(libraryDir)
local configText = fsu.loadFile(libraryDir / 'config.lua')
if not configText then
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index b1b7183e..94538a79 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -11,7 +11,6 @@ local vm = require 'vm.vm'
---@field _drop table
local mt = {}
mt.__index = mt
-mt._hasNumber = false
mt._hasTable = false
mt._hasClass = false
mt._hasFunctionDef = false
@@ -45,7 +44,6 @@ local viewNodeSwitch = util.switch()
end)
: case 'number'
: call(function (source, infer)
- infer._hasNumber = true
return source.type
end)
: case 'table'
@@ -81,9 +79,6 @@ local viewNodeSwitch = util.switch()
if not guide.isBasicType(source.name) then
infer._hasClass = true
end
- if source.name == 'number' then
- infer._hasNumber = true
- end
return source.name
end
end)
@@ -252,9 +247,6 @@ function vm.getInfer(source)
end
function mt:_trim()
- if self._hasNumber then
- self.views['integer'] = nil
- end
if self._hasDocFunction then
if self._hasFunctionDef then
for view in pairs(self.views) do
@@ -269,6 +261,13 @@ function mt:_trim()
if self._hasTable and not self._hasClass then
self.views['table'] = true
end
+ if self.views['number'] then
+ self.views['integer'] = nil
+ end
+ if self.views['boolean'] then
+ self.views['true'] = nil
+ self.views['false'] = nil
+ end
end
---@param uri uri