summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/template/builtin.lua22
-rw-r--r--script/core/infer.lua19
2 files changed, 30 insertions, 11 deletions
diff --git a/meta/template/builtin.lua b/meta/template/builtin.lua
index 45ac24af..06974076 100644
--- a/meta/template/builtin.lua
+++ b/meta/template/builtin.lua
@@ -1,18 +1,18 @@
---@meta
---@class unknown
----@class any: unknown
----@class nil: any
----@class boolean: any
----@class number: any
+---@class any
+---@class nil
+---@class boolean
+---@class number
---#if VERSION >= 5.3 then
----@class integer: number
+---@class integer
---#else
---@alias integer number
---#end
----@class thread: any
----@class table: any
----@class string: any
----@class userdata: any
----@class lightuserdata: userdata
----@class function:any
+---@class thread
+---@class table
+---@class string
+---@class userdata
+---@class lightuserdata
+---@class function
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 997df9a3..b42859c6 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -20,6 +20,21 @@ local TypeSort = {
['nil'] = 999,
}
+local innerTypeMap = {
+ ['unknown'] = true,
+ ['any'] = true,
+ ['nil'] = true,
+ ['boolean'] = true,
+ ['number'] = true,
+ ['integer'] = true,
+ ['thread'] = true,
+ ['table'] = true,
+ ['string'] = true,
+ ['userdata'] = true,
+ ['lightuserdata'] = true,
+ ['function'] = true,
+}
+
local m = {}
local function mergeTable(a, b)
@@ -648,4 +663,8 @@ function m.getClass(source)
return view
end
+function m.isInnerType(typeName)
+ return innerTypeMap[typeName] == true
+end
+
return m