diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-19 20:02:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-19 20:02:04 +0800 |
commit | 3db634a3a2e48a97772065e7e9da4d29a07a8098 (patch) | |
tree | 312333015381b0bb705a8377a609a2a84b54a345 /script | |
parent | 8760bf99594594e009bc6aa2bb1816eb02fc7006 (diff) | |
download | lua-language-server-3db634a3a2e48a97772065e7e9da4d29a07a8098.zip |
fix #809
Diffstat (limited to 'script')
-rw-r--r-- | script/core/noder.lua | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 59c103e8..ab8d2aa4 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -150,11 +150,23 @@ local function getFieldEventName(field) if not docFunc or docFunc.type ~= 'doc.type.function' then return nil end - local firstArg = docFunc.args and #docFunc.args == 2 and docFunc.args[1] + local firstArg = docFunc.args and docFunc.args[1] if not firstArg then return nil end - local secondArg = docFunc.args[2] + local secondArg + if firstArg.name[1] == 'self' then + firstArg = docFunc.args[2] + if not firstArg then + return nil + end + secondArg = docFunc.args[3] + else + secondArg = docFunc.args[2] + end + if not secondArg then + return + end local firstType = firstArg.extends if not firstType then return nil @@ -799,8 +811,10 @@ local function compileCallParam(noders, call, sourceID) if not nodeID then return end + local methodIndex = 0 if node.type == 'getmethod' then fixIndex = fixIndex + 1 + methodIndex = 1 end local eventNodeID for firstIndex, callArg in ipairs(call.args) do @@ -820,7 +834,7 @@ local function compileCallParam(noders, call, sourceID) local paramID = sformat('%s%s%s%s%s' , nodeID , PARAM_INDEX - , firstIndex + , firstIndex + methodIndex , PARAM_INDEX , secondIndex ) @@ -829,7 +843,7 @@ local function compileCallParam(noders, call, sourceID) local eventParamID = sformat('%s%s%s%s%s' , eventNodeID , PARAM_INDEX - , firstIndex + , firstIndex + methodIndex , PARAM_INDEX , secondIndex ) |