2929
3030local  m  =  {}
3131
32- m .ANY  =  {" ANY" 
33- 
34- m .ANYNOTGET  =  {" ANYNOTGET" 
32+ m .ANY  =  {" <ANY>" 
3533
3634local  blockTypes  =  {
3735 [' while' =  true ,
@@ -1401,6 +1399,16 @@ function m.searchFields(status, obj, key)
14011399 m .cleanResults (status .results )
14021400end 
14031401
1402+ function  m .searchDefFields (status , obj , key )
1403+  local  simple  =  m .getSimple (obj )
1404+  if  not  simple  then 
1405+  return 
1406+  end 
1407+  simple [# simple + 1 ] =  key  or  m .ANY 
1408+  m .searchSameFields (status , simple , ' deffield' 
1409+  m .cleanResults (status .results )
1410+ end 
1411+ 
14041412function  m .getObjectValue (obj )
14051413 while  obj .type  ==  ' paren'  do 
14061414 obj  =  obj .exp 
@@ -1436,7 +1444,7 @@ end
14361444
14371445function  m .checkSameSimpleInValueInMetaTable (status , mt , start , pushQueue )
14381446 local  newStatus  =  m .status (status )
1439-  m .searchFields (newStatus , mt , ' __index' 
1447+  m .searchDefFields (newStatus , mt , ' __index' 
14401448 local  refsStatus  =  m .status (status )
14411449 for  i  =  1 , # newStatus .results  do 
14421450 local  indexValue  =  m .getObjectValue (newStatus .results [i ])
@@ -1684,7 +1692,8 @@ function m.checkSameSimpleByDoc(status, obj, start, pushQueue, mode)
16841692 end 
16851693 return  true 
16861694 elseif  obj .type  ==  ' doc.field'  then 
1687-  if  mode  ~=  ' field'  then 
1695+  if  mode  ~=  ' field' 
1696+  and  mode  ~=  ' deffield'  then 
16881697 return  m .checkSameSimpleByDoc (status , obj .extends , start , pushQueue , mode )
16891698 end 
16901699 elseif  obj .type  ==  ' doc.type.array'  then 
@@ -2309,6 +2318,30 @@ function m.pushResult(status, mode, ref, simple)
23092318 or  ref .type  ==  ' doc.field'  then 
23102319 results [# results + 1 ] =  ref 
23112320 end 
2321+  elseif  mode  ==  ' deffield'  then 
2322+  if  ref .type  ==  ' setfield' 
2323+  or  ref .type  ==  ' tablefield'  then 
2324+  results [# results + 1 ] =  ref 
2325+  elseif  ref .type  ==  ' setmethod'  then 
2326+  results [# results + 1 ] =  ref 
2327+  elseif  ref .type  ==  ' setindex' 
2328+  or  ref .type  ==  ' tableindex'  then 
2329+  results [# results + 1 ] =  ref 
2330+  elseif  ref .type  ==  ' setglobal'  then 
2331+  results [# results + 1 ] =  ref 
2332+  elseif  ref .type  ==  ' function'  then 
2333+  results [# results + 1 ] =  ref 
2334+  elseif  ref .type  ==  ' table'  then 
2335+  results [# results + 1 ] =  ref 
2336+  elseif  ref .type  ==  ' call'  then 
2337+  if  ref .node .special  ==  ' rawset'  then 
2338+  results [# results + 1 ] =  ref 
2339+  end 
2340+  elseif  ref .type  ==  ' doc.type.function' 
2341+  or  ref .type  ==  ' doc.class.name' 
2342+  or  ref .type  ==  ' doc.field'  then 
2343+  results [# results + 1 ] =  ref 
2344+  end 
23122345 end 
23132346end 
23142347
@@ -2317,7 +2350,7 @@ function m.checkSameSimpleName(ref, sm)
23172350 return  true 
23182351 end 
23192352
2320-  if  sm  ==  m .ANYNOTGET  and  not   m . isGet (ref ) then 
2353+  if  sm  ==  m .ANY_DEF  and  m . isSet (ref ) then 
23212354 return  true 
23222355 end 
23232356
@@ -2663,13 +2696,16 @@ function m.searchRefs(status, obj, mode)
26632696 end 
26642697
26652698 --  检查单步引用
2699+  tracy .ZoneBeginN (' searchRefs getStepRef' 
26662700 local  res  =  m .getStepRef (status , obj , mode )
26672701 if  res  then 
26682702 for  i  =  1 , # res  do 
26692703 status .results [# status .results + 1 ] =  res [i ]
26702704 end 
26712705 end 
2706+  tracy .ZoneEnd ()
26722707 --  检查simple
2708+  tracy .ZoneBeginN (' searchRefs searchSameFields' 
26732709 if  status .depth  <=  100  then 
26742710 local  simple  =  m .getSimple (obj )
26752711 if  simple  then 
@@ -2683,6 +2719,7 @@ function m.searchRefs(status, obj, mode)
26832719 logWarn (' status.depth overflow' 
26842720 end 
26852721 end 
2722+  tracy .ZoneEnd ()
26862723
26872724 m .cleanResults (status .results )
26882725
@@ -4103,8 +4140,8 @@ function m.requestDefinition(obj, interface, deep)
41034140 return  status .results , status .share .count 
41044141end 
41054142
4106- ---  请求对象的域 
4107- --- @param  filterKey  nil | string | table nil  表 fields 不做限制; string 表 fields 必须同名; table 取值为 guild.ANYSET 表 fields 必须满足 isSet () 
4143+ ---  请求对象的字段 
4144+ --- @param  filterKey  nil | string | table 
41084145function  m .requestFields (obj , interface , deep , filterKey )
41094146 local  status  =  m .status (nil , interface , deep )
41104147
@@ -4113,6 +4150,16 @@ function m.requestFields(obj, interface, deep, filterKey)
41134150 return  status .results , status .share .count 
41144151end 
41154152
4153+ ---  请求对象的定义字段
4154+ --- @param  filterKey  nil | string | table 
4155+ function  m .requestDefFields (obj , interface , deep , filterKey )
4156+  local  status  =  m .status (nil , interface , deep )
4157+ 
4158+  m .searchDefFields (status , obj , filterKey )
4159+ 
4160+  return  status .results , status .share .count 
4161+ end 
4162+ 
41164163---  请求对象的类型推测
41174164function  m .requestInfer (obj , interface , deep )
41184165 local  status  =  m .status (nil , interface , deep )
0 commit comments