summaryrefslogtreecommitdiff
path: root/script-beta/vm/getClass.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/vm/getClass.lua')
-rw-r--r--script-beta/vm/getClass.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua
index 522ca026..0d6980a2 100644
--- a/script-beta/vm/getClass.lua
+++ b/script-beta/vm/getClass.lua
@@ -1,6 +1,18 @@
local vm = require 'vm.vm'
local guide = require 'parser.guide'
+local function lookUpDocClass(source)
+ local docs = source.bindDocs
+ if not docs then
+ return
+ end
+ for _, doc in ipairs(docs) do
+ if doc.type == 'doc.class' then
+ return guide.getName(doc)
+ end
+ end
+end
+
local function getClass(source, classes, deep, simple)
local lib = vm.getLibrary(source, simple)
if lib then
@@ -11,6 +23,11 @@ local function getClass(source, classes, deep, simple)
end
return
end
+ local docClass = lookUpDocClass(source)
+ if docClass then
+ classes[#classes+1] = docClass
+ return
+ end
if deep > 3 then
return
end