Skip to content

Commit 2e8a8db

Browse files
committed
enum具有partial时会提示所有同enum字段而不是只提示当前表的字段.
1 parent d702a55 commit 2e8a8db

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

script/vm/compiler.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,41 @@ local searchFieldSwitch = util.switch()
189189
end
190190
end
191191
end
192+
local docs = source.bindDocs
193+
if docs then
194+
for _, doc in ipairs(docs) do
195+
if doc.type == 'doc.enum' then
196+
if not vm.docHasAttr(doc, 'partial') then
197+
return
198+
end
199+
for _, def in ipairs(vm.getDefs(doc)) do
200+
if def.type ~= 'doc.enum' then
201+
goto CONTINUE
202+
end
203+
local tbl = def.bindSource
204+
if not tbl then
205+
return
206+
end
207+
for _, field in ipairs(tbl) do
208+
if field.type == 'tablefield'
209+
or field.type == 'tableindex' then
210+
if not field.value then
211+
goto CONTINUE
212+
end
213+
local fieldKey = guide.getKeyName(field)
214+
if key == vm.ANY
215+
or key == fieldKey then
216+
hasFiled = true
217+
pushResult(field)
218+
end
219+
::CONTINUE::
220+
end
221+
end
222+
::CONTINUE::
223+
end
224+
end
225+
end
226+
end
192227
end)
193228
: case 'string'
194229
: case 'doc.type.string'

0 commit comments

Comments
 (0)