@@ -293,6 +293,14 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
293
293
if set .type == ' doc.class' then
294
294
-- check ---@field
295
295
local hasFounded = {}
296
+
297
+ local function copyToSearched ()
298
+ for fieldKey in pairs (hasFounded ) do
299
+ searchedFields [fieldKey ] = true
300
+ hasFounded [fieldKey ] = nil
301
+ end
302
+ end
303
+
296
304
for _ , field in ipairs (set .fields ) do
297
305
local fieldKey = guide .getKeyName (field )
298
306
if fieldKey then
@@ -342,8 +350,9 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
342
350
end
343
351
end
344
352
end
353
+ copyToSearched ()
345
354
-- check local field and global field
346
- if not hasFounded [key ] and set .bindSource then
355
+ if not searchedFields [key ] and set .bindSource then
347
356
local src = set .bindSource
348
357
if src .value and src .value .type == ' table' then
349
358
searchFieldSwitch (' table' , suri , src .value , key , ref , function (field )
@@ -357,22 +366,21 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
357
366
end
358
367
end )
359
368
end
369
+ copyToSearched ()
360
370
searchFieldSwitch (src .type , suri , src , key , ref , function (field )
361
371
local fieldKey = guide .getKeyName (field )
362
- if fieldKey and not hasFounded [fieldKey ] then
372
+ if fieldKey and not searchedFields [fieldKey ] then
363
373
if not searchedFields [fieldKey ]
364
374
and guide .isSet (field ) then
365
375
hasFounded [fieldKey ] = true
366
376
pushResult (field , true )
367
377
end
368
378
end
369
379
end )
380
+ copyToSearched ()
370
381
end
371
382
-- look into extends(if field not found)
372
- if not hasFounded [key ] and set .extends then
373
- for fieldKey in pairs (hasFounded ) do
374
- searchedFields [fieldKey ] = true
375
- end
383
+ if not searchedFields [key ] and set .extends then
376
384
for _ , extend in ipairs (set .extends ) do
377
385
if extend .type == ' doc.extends.name' then
378
386
local extendType = vm .getGlobal (' type' , extend [1 ])
@@ -381,6 +389,7 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
381
389
end
382
390
end
383
391
end
392
+ copyToSearched ()
384
393
end
385
394
end
386
395
end
0 commit comments