6262
6363--- @param source parser.object
6464--- @param key any
65- --- @param ref boolean
6665--- @param pushResult fun ( res : parser.object , markDoc ?: boolean )
67- local function searchFieldByLocalID (source , key , ref , pushResult )
66+ local function searchFieldByLocalID (source , key , pushResult )
6867 local fields
6968 if key then
7069 fields = vm .getLocalSourcesSets (source , key )
71- if ref then
72- local gets = vm .getLocalSourcesGets (source , key )
73- if gets then
74- fields = fields or {}
75- for _ , src in ipairs (gets ) do
76- fields [# fields + 1 ] = src
77- end
78- end
79- end
8070 else
8171 fields = vm .getLocalFields (source , false )
8272 end
10696--- @param suri uri
10797--- @param source parser.object
10898--- @param key any
109- --- @param ref boolean
11099--- @param pushResult fun ( res : parser.object , markDoc ?: boolean )
111- local function searchFieldByGlobalID (suri , source , key , ref , pushResult )
100+ local function searchFieldByGlobalID (suri , source , key , pushResult )
112101 local node = vm .getGlobalNode (source )
113102 if not node then
114103 return
@@ -123,30 +112,24 @@ local function searchFieldByGlobalID(suri, source, key, ref, pushResult)
123112 for _ , set in ipairs (global :getSets (suri )) do
124113 pushResult (set )
125114 end
126- for _ , get in ipairs (global :getGets (suri )) do
127- pushResult (get )
128- end
129115 end
130116 else
131117 local globals = vm .getGlobalFields (' variable' , node .name )
132118 for _ , global in ipairs (globals ) do
133119 for _ , set in ipairs (global :getSets (suri )) do
134120 pushResult (set )
135121 end
136- for _ , get in ipairs (global :getGets (suri )) do
137- pushResult (get )
138- end
139122 end
140123 end
141124 end
142125 if node .cate == ' type' then
143- vm .getClassFields (suri , node , key , ref , pushResult )
126+ vm .getClassFields (suri , node , key , pushResult )
144127 end
145128end
146129
147130local searchFieldSwitch = util .switch ()
148131 : case ' table'
149- : call (function (suri , source , key , ref , pushResult )
132+ : call (function (suri , source , key , pushResult )
150133 local hasFiled = false
151134 for _ , field in ipairs (source ) do
152135 if field .type == ' tablefield'
@@ -181,15 +164,15 @@ local searchFieldSwitch = util.switch()
181164 end )
182165 : case ' string'
183166 : case ' doc.type.string'
184- : call (function (suri , source , key , ref , pushResult )
167+ : call (function (suri , source , key , pushResult )
185168 -- change to `string: stringlib` ?
186169 local stringlib = vm .getGlobal (' type' , ' stringlib' )
187170 if stringlib then
188- vm .getClassFields (suri , stringlib , key , ref , pushResult )
171+ vm .getClassFields (suri , stringlib , key , pushResult )
189172 end
190173 end )
191174 : case ' doc.type.array'
192- : call (function (suri , source , key , ref , pushResult )
175+ : call (function (suri , source , key , pushResult )
193176 if type (key ) == ' number' then
194177 if key < 1
195178 or not math.tointeger (key ) then
@@ -204,7 +187,7 @@ local searchFieldSwitch = util.switch()
204187 end
205188 end )
206189 : case ' doc.type.table'
207- : call (function (suri , source , key , ref , pushResult )
190+ : call (function (suri , source , key , pushResult )
208191 if type (key ) == ' string' and key :find (vm .ID_SPLITE ) then
209192 return
210193 end
@@ -240,7 +223,7 @@ local searchFieldSwitch = util.switch()
240223 end
241224 end )
242225 : case ' global'
243- : call (function (suri , node , key , ref , pushResult )
226+ : call (function (suri , node , key , pushResult )
244227 if node .cate == ' variable' then
245228 if key then
246229 if type (key ) ~= ' string' then
@@ -251,41 +234,30 @@ local searchFieldSwitch = util.switch()
251234 for _ , set in ipairs (global :getSets (suri )) do
252235 pushResult (set )
253236 end
254- if ref then
255- for _ , get in ipairs (global :getGets (suri )) do
256- pushResult (get )
257- end
258- end
259237 end
260238 else
261239 local globals = vm .getGlobalFields (' variable' , node .name )
262240 for _ , global in ipairs (globals ) do
263241 for _ , set in ipairs (global :getSets (suri )) do
264242 pushResult (set )
265243 end
266- if ref then
267- for _ , get in ipairs (global :getGets (suri )) do
268- pushResult (get )
269- end
270- end
271244 end
272245 end
273246 end
274247 if node .cate == ' type' then
275- vm .getClassFields (suri , node , key , ref , pushResult )
248+ vm .getClassFields (suri , node , key , pushResult )
276249 end
277250 end )
278- : default (function (suri , source , key , ref , pushResult )
279- searchFieldByLocalID (source , key , ref , pushResult )
280- searchFieldByGlobalID (suri , source , key , ref , pushResult )
251+ : default (function (suri , source , key , pushResult )
252+ searchFieldByLocalID (source , key , pushResult )
253+ searchFieldByGlobalID (suri , source , key , pushResult )
281254 end )
282255
283256--- @param suri uri
284257--- @param object vm.global
285258--- @param key ? string | number | integer | boolean | vm.global
286- --- @param ref boolean
287259--- @param pushResult fun ( field : vm.object , isMark ?: boolean )
288- function vm .getClassFields (suri , object , key , ref , pushResult )
260+ function vm .getClassFields (suri , object , key , pushResult )
289261 local mark = {}
290262
291263 local function searchClass (class , searchedFields )
@@ -375,7 +347,7 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
375347 if not searchedFields [key ] and set .bindSource then
376348 local src = set .bindSource
377349 if src .value and src .value .type == ' table' then
378- searchFieldSwitch (' table' , suri , src .value , key , ref , function (field )
350+ searchFieldSwitch (' table' , suri , src .value , key , function (field )
379351 local fieldKey = guide .getKeyName (field )
380352 if fieldKey then
381353 if not searchedFields [fieldKey ]
@@ -395,7 +367,7 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
395367 and args
396368 and args [1 ]
397369 and args [1 ].type == ' table' then
398- searchFieldSwitch (' table' , suri , args [1 ], key , ref , function (field )
370+ searchFieldSwitch (' table' , suri , args [1 ], key , function (field )
399371 local fieldKey = guide .getKeyName (field )
400372 if fieldKey then
401373 if not searchedFields [fieldKey ]
@@ -416,7 +388,7 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
416388 if set .type == ' doc.class' then
417389 if not searchedFields [key ] and set .bindSource then
418390 local src = set .bindSource
419- searchFieldSwitch (src .type , suri , src , key , ref , function (field )
391+ searchFieldSwitch (src .type , suri , src , key , function (field )
420392 local fieldKey = guide .getKeyName (field )
421393 if fieldKey and not searchedFields [fieldKey ] then
422394 if not searchedFields [fieldKey ]
@@ -524,7 +496,7 @@ local function getReturnOfSetMetaTable(args)
524496 node :merge (vm .compileNode (tbl ))
525497 end
526498 if mt then
527- vm .compileByParentNode (mt , ' __index' , false , function (src )
499+ vm .compileByParentNode (mt , ' __index' , function (src )
528500 for n in vm .compileNode (src ):eachObject () do
529501 if n .type == ' global'
530502 or n .type == ' local'
652624--- @param source parser.object
653625--- @param key ? string | vm.global
654626--- @param pushResult fun ( source : parser.object )
655- function vm .compileByParentNode (source , key , ref , pushResult )
627+ function vm .compileByParentNode (source , key , pushResult )
656628 local parentNode = vm .compileNode (source )
657629 local docedResults = {}
658630 local commonResults = {}
@@ -677,7 +649,7 @@ function vm.compileByParentNode(source, key, ref, pushResult)
677649 and not guide .isBasicType (node .name )
678650 )
679651 or guide .isLiteral (node ) then
680- searchFieldSwitch (node .type , suri , node , key , ref , function (res , markDoc )
652+ searchFieldSwitch (node .type , suri , node , key , function (res , markDoc )
681653 if mark [res ] then
682654 return
683655 end
@@ -692,7 +664,7 @@ function vm.compileByParentNode(source, key, ref, pushResult)
692664 end
693665
694666 if not next (mark ) then
695- searchFieldByLocalID (source , key , ref , function (res , markDoc )
667+ searchFieldByLocalID (source , key , function (res , markDoc )
696668 if mark [res ] then
697669 return
698670 end
@@ -1298,7 +1270,7 @@ local compilerSwitch = util.switch()
12981270 for k in key :eachObject () do
12991271 if k .type == ' global' and k .cate == ' type' then
13001272 --- @cast k vm.global
1301- vm .compileByParentNode (source .node , k , false , function (src )
1273+ vm .compileByParentNode (source .node , k , function (src )
13021274 vm .setNode (source , vm .compileNode (src ))
13031275 if src .value then
13041276 vm .setNode (source , vm .compileNode (src .value ))
@@ -1308,7 +1280,7 @@ local compilerSwitch = util.switch()
13081280 end
13091281 else
13101282 --- @cast key string
1311- vm .compileByParentNode (source .node , key , false , function (src )
1283+ vm .compileByParentNode (source .node , key , function (src )
13121284 if src .value then
13131285 if bindDocs (src ) then
13141286 vm .setNode (source , vm .compileNode (src ))
@@ -1331,7 +1303,7 @@ local compilerSwitch = util.switch()
13311303 return
13321304 end
13331305 local key = guide .getKeyName (source )
1334- vm .compileByParentNode (source .node , key , false , function (src )
1306+ vm .compileByParentNode (source .node , key , function (src )
13351307 if src .type == ' doc.type.field'
13361308 or src .type == ' doc.field' then
13371309 vm .setNode (source , vm .compileNode (src ))
@@ -1347,7 +1319,7 @@ local compilerSwitch = util.switch()
13471319 return
13481320 end
13491321 local key = guide .getKeyName (source )
1350- vm .compileByParentNode (source .node , key , false , function (src )
1322+ vm .compileByParentNode (source .node , key , function (src )
13511323 vm .setNode (source , vm .compileNode (src ))
13521324 end )
13531325 end )
@@ -1360,7 +1332,7 @@ local compilerSwitch = util.switch()
13601332 end
13611333
13621334 if not hasMarkDoc then
1363- vm .compileByParentNode (source .node , guide .getKeyName (source ), false , function (src )
1335+ vm .compileByParentNode (source .node , guide .getKeyName (source ), function (src )
13641336 if src .type == ' doc.field'
13651337 or src .type == ' doc.type.field'
13661338 or src .type == ' doc.type.name' then
@@ -1383,7 +1355,7 @@ local compilerSwitch = util.switch()
13831355 : case ' tableexp'
13841356 : call (function (source )
13851357 local hasMarkDoc
1386- vm .compileByParentNode (source .parent , source .tindex , false , function (src )
1358+ vm .compileByParentNode (source .parent , source .tindex , function (src )
13871359 if src .type == ' doc.field'
13881360 or src .type == ' doc.type.field'
13891361 or src .type == ' doc.type.name'
@@ -1894,7 +1866,7 @@ local nodeSwitch;nodeSwitch = util.switch()
18941866 key = key .. vm .ID_SPLITE .. lastKey
18951867 end
18961868 for pn in parentNode :eachObject () do
1897- searchFieldSwitch (pn .type , uri , pn , key , false , pushResult )
1869+ searchFieldSwitch (pn .type , uri , pn , key , pushResult )
18981870 end
18991871 return key , source .node
19001872 end )
@@ -1911,7 +1883,7 @@ local nodeSwitch;nodeSwitch = util.switch()
19111883 local uri = guide .getUri (source )
19121884 local parentNode = vm .compileNode (source .node )
19131885 for pn in parentNode :eachObject () do
1914- searchFieldSwitch (pn .type , uri , pn , key , false , pushResult )
1886+ searchFieldSwitch (pn .type , uri , pn , key , pushResult )
19151887 end
19161888 end )
19171889
0 commit comments