Closed tomlau10 closed 2 weeks ago
closes #2695 (the feature request by me, finally I have the knowledge to implement myself 🙂 )
fun()
Lua.type.inferParamType
true
---@param callback fun(a: integer) function register(callback) end local function callback(a) end --> a: integer register(callback)
which is similar to existing infer behavior with function literal:
register(function (a) --> a: integer end)
doc.type.function
vm.compileCallArg()
cbIndex
args[aindex]
closes #2695 (the feature request by me, finally I have the knowledge to implement myself 🙂 )
fun()
annotation.Lua.type.inferParamType
logic, so this feature is only enabled when this config is set totrue
.Example Use Case
which is similar to existing infer behavior with function literal:
中文版
Lua.type.inferParamType
功能的延伸,所以要開啟這個 config 才會生效實現思路
doc.type.function
(如有) 來進一步 infervm.compileCallArg()
可以 compile 某個 call 行為的指定 index argument typecbIndex
的 arg infer typedoc.type.function
,則再利用這 function 的args[aindex]
(當前 local function param index) 的 type 來做 infer