@@ -882,52 +882,69 @@ local function compileCallArgNode(arg, call, callNode, fixIndex, myIndex)
882882 end
883883 end
884884
885- for n in callNode :eachObject () do
886- if n .type == ' function' then
887- --- @cast n parser.object
888- local sign = vm .getSign (n )
885+ --- @param n parser.object
886+ local function dealDocFunc (n )
887+ local myEvent
888+ if n .args [eventIndex ] then
889+ local argNode = vm .compileNode (n .args [eventIndex ])
890+ myEvent = argNode :get (1 )
891+ end
892+ if not myEvent
893+ or not eventMap
894+ or myIndex <= eventIndex
895+ or myEvent .type ~= ' doc.type.string'
896+ or eventMap [myEvent [1 ]] then
889897 local farg = getFuncArg (n , myIndex )
890898 if farg then
891899 for fn in vm .compileNode (farg ):eachObject () do
892900 if isValidCallArgNode (arg , fn ) then
893- if fn .type == ' doc.type.function' then
894- --- @cast fn parser.object
895- if sign then
896- local generic = vm .createGeneric (fn , sign )
897- local args = {}
898- for i = fixIndex + 1 , myIndex - 1 do
899- args [# args + 1 ] = call .args [i ]
900- end
901- local resolvedNode = generic :resolve (guide .getUri (call ), args )
902- vm .setNode (arg , resolvedNode )
903- goto CONTINUE
904- end
905- end
906901 vm .setNode (arg , fn )
907- :: CONTINUE::
908902 end
909903 end
910904 end
911905 end
912- if n .type == ' doc.type.function' then
913- --- @cast n parser.object
914- local myEvent
915- if n .args [eventIndex ] then
916- local argNode = vm .compileNode (n .args [eventIndex ])
917- myEvent = argNode :get (1 )
918- end
919- if not myEvent
920- or not eventMap
921- or myIndex <= eventIndex
922- or myEvent .type ~= ' doc.type.string'
923- or eventMap [myEvent [1 ]] then
924- local farg = getFuncArg (n , myIndex )
925- if farg then
926- for fn in vm .compileNode (farg ):eachObject () do
927- if isValidCallArgNode (arg , fn ) then
928- vm .setNode (arg , fn )
906+ end
907+
908+ --- @param n parser.object
909+ local function dealFunction (n )
910+ local sign = vm .getSign (n )
911+ local farg = getFuncArg (n , myIndex )
912+ if farg then
913+ for fn in vm .compileNode (farg ):eachObject () do
914+ if isValidCallArgNode (arg , fn ) then
915+ if fn .type == ' doc.type.function' then
916+ --- @cast fn parser.object
917+ if sign then
918+ local generic = vm .createGeneric (fn , sign )
919+ local args = {}
920+ for i = fixIndex + 1 , myIndex - 1 do
921+ args [# args + 1 ] = call .args [i ]
922+ end
923+ local resolvedNode = generic :resolve (guide .getUri (call ), args )
924+ vm .setNode (arg , resolvedNode )
925+ goto CONTINUE
929926 end
930927 end
928+ vm .setNode (arg , fn )
929+ :: CONTINUE::
930+ end
931+ end
932+ end
933+ end
934+
935+ for n in callNode :eachObject () do
936+ if n .type == ' function' then
937+ --- @cast n parser.object
938+ dealFunction (n )
939+ elseif n .type == ' doc.type.function' then
940+ --- @cast n parser.object
941+ dealDocFunc (n )
942+ elseif n .type == ' global' and n .cate == ' type' then
943+ --- @cast n vm.global
944+ local overloads = vm .getOverloadsByTypeName (n .name , guide .getUri (arg ))
945+ if overloads then
946+ for _ , func in ipairs (overloads ) do
947+ dealDocFunc (func )
931948 end
932949 end
933950 end
0 commit comments