diff options
Diffstat (limited to 'script-beta/vm/getLibrary.lua')
-rw-r--r-- | script-beta/vm/getLibrary.lua | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index eaeeafa3..5803a73b 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -1,65 +1,6 @@ local vm = require 'vm.vm' -local guide = require 'parser.guide' -local library = require 'library' - -local function getLibrary(source, deep) - if source.type == 'library' then - return source - end - if source.library then - return source.library - end - if source.type == 'getglobal' - or source.type == 'setglobal' then - if source.node and source.node.type == 'local' then - local lib = library.global[guide.getName(source)] - if lib then - return lib - end - end - end - - local unlock = vm.lock('getLibrary', source) - if not unlock then - return - end - - local defs = vm.getDefs(source, deep) - unlock() - - for _, def in ipairs(defs) do - if def.type == 'library' then - return def - end - end - - return nil -end - -function vm.getLibrary(source, deep) - if guide.isGlobal(source) then - local name = guide.getKeyName(source) - local cache = vm.getCache('getLibraryOfGlobal')[name] - or vm.getCache('getLibrary')[source] - or getLibrary(source, 'deep') - vm.getCache('getLibraryOfGlobal')[name] = cache - vm.getCache('getLibrary')[source] = cache - return cache - else - local cache = vm.getCache('getLibrary')[source] - or getLibrary(source, deep) - if deep then - vm.getCache('getLibrary')[source] = cache - end - return cache - end -end function vm.getLibraryName(source, deep) - local lib = vm.getLibrary(source, deep) - if lib then - return lib.name - end local defs = vm.getDefs(source, deep) for _, def in ipairs(defs) do if def.special then |