Skip to content

Commit f0d98a2

Browse files
authored
Merge pull request #2841 from Luke100000/master
Fixed injects into child classes
2 parents 72effcc + 5f07b7e commit f0d98a2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

script/vm/compiler.lua

+20
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,26 @@ local function searchFieldByLocalID(source, key, pushResult)
101101
if not fields then
102102
return
103103
end
104+
105+
--Exact classes do not allow injected fields
106+
if source.type ~= 'variable' and source.bindDocs then
107+
---@cast source parser.object
108+
local uri = guide.getUri(source)
109+
for _, src in ipairs(fields) do
110+
if src.type == "setfield" then
111+
local class = vm.getDefinedClass(uri, source)
112+
if class then
113+
for _, doc in ipairs(class:getSets(uri)) do
114+
if vm.docHasAttr(doc, 'exact') then
115+
return
116+
end
117+
end
118+
end
119+
end
120+
end
121+
end
122+
123+
104124
local hasMarkDoc = {}
105125
for _, src in ipairs(fields) do
106126
if src.bindDocs then

0 commit comments

Comments
 (0)