@@ -1506,6 +1506,29 @@ function m.checkSameSimpleInSpecialBranch(status, obj, start, pushQueue)
1506
1506
end
1507
1507
end
1508
1508
1509
+ function m .checkSameSimpleInParamSelf (status , obj , start , pushQueue )
1510
+ if obj .type ~= ' getlocal' or obj [1 ] ~= ' self' then
1511
+ return
1512
+ end
1513
+ local node = obj .node
1514
+ if node .tag == ' self' then
1515
+ return
1516
+ end
1517
+ if node .parent .type ~= ' funcargs' then
1518
+ return
1519
+ end
1520
+ local func = node .parent .parent
1521
+ if func .type ~= ' function' or func .parent .type ~= ' setfield' then
1522
+ return
1523
+ end
1524
+ local fieldNode = func .parent .node
1525
+ local newStatus = m .status (status )
1526
+ m .searchRefs (newStatus , fieldNode , ' ref' )
1527
+ for _ , ref in ipairs (newStatus .results ) do
1528
+ pushQueue (ref , start , true )
1529
+ end
1530
+ end
1531
+
1509
1532
local function appendValidGenericType (results , status , typeName , obj )
1510
1533
if typeName .parent .type == ' doc.type.typeliteral' then
1511
1534
if obj .type == ' string' and status .interface .docType then
@@ -2415,6 +2438,8 @@ function m.checkSameSimple(status, simple, ref, start, force, mode, pushQueue)
2415
2438
m .checkSameSimpleInValueOfCallMetaTable (status , ref , i , pushQueue )
2416
2439
-- 检查自己是特殊变量的分支的情况
2417
2440
m .checkSameSimpleInSpecialBranch (status , ref , i , pushQueue )
2441
+ -- self 的特殊处理
2442
+ m .checkSameSimpleInParamSelf (status , ref , i , pushQueue )
2418
2443
if cmode == ' ref' then
2419
2444
-- 检查形如 { a = f } 的情况
2420
2445
m .checkSameSimpleAsTableField (status , ref , i , pushQueue )
0 commit comments