Skip to content

Commit df9db56

Browse files
committed
compute table keys once
1 parent 9035afd commit df9db56

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

script/core/diagnostics/missing-fields.lua

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,23 @@ return function (uri, callback)
3535
return
3636
end
3737
end
38-
38+
39+
local myKeys
3940
local warnings = {}
4041
for className, samedefs in pairs(sortedDefs) do
4142
local missedKeys = {}
4243
for _, def in ipairs(samedefs) do
4344
if not def.fields or #def.fields == 0 then
4445
goto continue
4546
end
46-
47-
local myKeys = {}
48-
for _, field in ipairs(src) do
49-
local key = vm.getKeyName(field) or field.tindex
50-
if key then
51-
myKeys[key] = true
47+
48+
if not myKeys then
49+
myKeys = {}
50+
for _, field in ipairs(src) do
51+
local key = vm.getKeyName(field) or field.tindex
52+
if key then
53+
myKeys[key] = true
54+
end
5255
end
5356
end
5457

0 commit comments

Comments
 (0)