File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,39 @@ return function (uri, callback)
5252 }
5353 end
5454 end
55+ --- @async
56+ local function checkUndefinedFieldByIndexEnum (src )
57+ await .delay ()
58+ local isEnum = false
59+ for _ , node in ipairs (vm .compileNode (src .node )) do
60+ local docs = node .bindDocs
61+ if docs then
62+ for _ , doc in ipairs (docs ) do
63+ if doc .type == " doc.enum" then
64+ isEnum = true
65+ break
66+ end
67+ end
68+ end
69+ end
70+ if not isEnum then
71+ return
72+ end
73+ if vm .hasDef (src ) then
74+ return
75+ end
76+ local keyName = guide .getKeyName (src )
77+ if not keyName then
78+ return
79+ end
80+ local message = lang .script (' DIAG_UNDEF_FIELD' , guide .getKeyName (src ))
81+ callback {
82+ start = src .index .start ,
83+ finish = src .index .finish ,
84+ message = message ,
85+ }
86+ end
5587 guide .eachSourceType (ast .ast , ' getfield' , checkUndefinedField )
5688 guide .eachSourceType (ast .ast , ' getmethod' , checkUndefinedField )
89+ guide .eachSourceType (ast .ast , ' getindex' , checkUndefinedFieldByIndexEnum )
5790end
You can’t perform that action at this time.
0 commit comments