summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/vm.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/script/vm/vm.lua b/script/vm/vm.lua
index 8117d311..b9eccfa3 100644
--- a/script/vm/vm.lua
+++ b/script/vm/vm.lua
@@ -64,6 +64,20 @@ function m.getObjectValue(source)
return nil
end
+---@param source parser.object
+---@return parser.object?
+function m.getObjectFunctionValue(source)
+ local value = m.getObjectValue(source)
+ if value == nil then return end
+ if value.type == 'function' or value.type == 'doc.type.function' then
+ return value
+ end
+ if value.type == 'getlocal' then
+ return m.getObjectFunctionValue(value.node)
+ end
+ return nil
+end
+
m.cacheTracker = setmetatable({}, weakMT)
function m.flushCache()