diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:44:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:44:57 +0800 |
commit | 4f2e91dad259b6559cec651b10718e1a19352fc3 (patch) | |
tree | 581b8bdc73440ded32db5cb0a1a191a02fa64372 /script-beta/vm | |
parent | 9cd44e1b61fa8f002b211224e0141812a8fc97e6 (diff) | |
download | lua-language-server-4f2e91dad259b6559cec651b10718e1a19352fc3.zip |
use meta instead of library
Diffstat (limited to 'script-beta/vm')
-rw-r--r-- | script-beta/vm/eachField.lua | 25 | ||||
-rw-r--r-- | script-beta/vm/getClass.lua | 9 | ||||
-rw-r--r-- | script-beta/vm/getDocs.lua | 34 | ||||
-rw-r--r-- | script-beta/vm/getGlobals.lua | 18 | ||||
-rw-r--r-- | script-beta/vm/getLibrary.lua | 59 | ||||
-rw-r--r-- | script-beta/vm/guideInterface.lua | 21 | ||||
-rw-r--r-- | script-beta/vm/vm.lua | 3 |
7 files changed, 0 insertions, 169 deletions
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua index 38087d6a..ce0e3928 100644 --- a/script-beta/vm/eachField.lua +++ b/script-beta/vm/eachField.lua @@ -1,25 +1,6 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' -local library = require 'library' local await = require 'await' -local config = require 'config' - -local function eachFieldInLibrary(source, lib, results) - if not lib or not lib.child then - return - end - for _, value in pairs(lib.child) do - if value.name:sub(1, 1) ~= '@' then - results[#results+1] = value - end - end -end - -local function eachFieldOfLibrary(results) - for _, lib in pairs(library.global) do - results[#results+1] = lib - end -end local function eachField(source, deep) local unlock = vm.lock('eachField', source) @@ -36,12 +17,6 @@ local function eachField(source, deep) await.delay() local results = guide.requestFields(source, vm.interface, deep) - if source.special == '_G' then - eachFieldOfLibrary(results) - end - if library.object[source.type] then - eachFieldInLibrary(source, library.object[source.type], results) - end unlock() return results diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua index 1623090c..a8bd7e40 100644 --- a/script-beta/vm/getClass.lua +++ b/script-beta/vm/getClass.lua @@ -12,15 +12,6 @@ local function lookUpDocClass(source) end local function getClass(source, classes, depth, deep) - local lib = vm.getLibrary(source, deep) - if lib then - if lib.value.type == 'table' then - classes[#classes+1] = lib.value.name - else - classes[#classes+1] = lib.value.type - end - return - end local docClass = lookUpDocClass(source) if docClass then classes[#classes+1] = docClass diff --git a/script-beta/vm/getDocs.lua b/script-beta/vm/getDocs.lua index fcc67d32..c06efc11 100644 --- a/script-beta/vm/getDocs.lua +++ b/script-beta/vm/getDocs.lua @@ -4,30 +4,6 @@ local guide = require 'parser.guide' local vm = require 'vm.vm' local config = require 'config' -local builtin = {} -for _, name in ipairs { - 'any' , - 'nil' , - 'void' , - 'boolean' , - 'number' , - 'integer' , - 'thread' , - 'table' , - 'file' , - 'string' , - 'userdata' , - 'lightuserdata', - 'function' , -} do - builtin[#builtin+1] = { - type = 'doc.class.name', - start = 0, - finish = 0, - [1] = name, - } -end - local function getTypesOfFile(uri) local types = {} local ast = files.getAst(uri) @@ -70,13 +46,6 @@ local function getDocTypes(name) end end end - if not DEVELOP then - for _, source in ipairs(builtin) do - if name == '*' or name == source[1] then - results[#results+1] = source - end - end - end return results end @@ -193,9 +162,6 @@ local function isDeprecated(value) end function vm.isDeprecated(value) - if isDeprecated(value) then - return true - end local defs = vm.getDefs(value, 'deep') if #defs == 0 then return false diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua index 4fe95ee9..83d6a5e6 100644 --- a/script-beta/vm/getGlobals.lua +++ b/script-beta/vm/getGlobals.lua @@ -1,7 +1,6 @@ local guide = require 'parser.guide' local vm = require 'vm.vm' local files = require 'files' -local library = require 'library' local util = require 'utility' local config = require 'config' @@ -67,19 +66,6 @@ local function getGlobalSetsOfFile(uri) return globals end -local function insertLibrary(results, name) - if name:sub(1, 2) == 's|' then - local libname = name:sub(3) - results[#results+1] = library.global[libname] - local asName = config.config.runtime.special[libname] - results[#results+1] = library.global[asName] - elseif name == '*' then - for _, lib in pairs(library.global) do - results[#results+1] = lib - end - end -end - local function getGlobals(name) local results = {} for uri in files.eachFile() do @@ -98,7 +84,6 @@ local function getGlobals(name) end end end - insertLibrary(results, name) return results end @@ -120,7 +105,6 @@ local function getGlobalSets(name) end end end - insertLibrary(results, name) return results end @@ -143,7 +127,6 @@ local function fastGetAnyGlobals() end end end - insertLibrary(results, '*') return results end @@ -159,7 +142,6 @@ local function fastGetAnyGlobalSets() end end end - insertLibrary(results, '*') return results end 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 diff --git a/script-beta/vm/guideInterface.lua b/script-beta/vm/guideInterface.lua index 6ecae5a8..e646def8 100644 --- a/script-beta/vm/guideInterface.lua +++ b/script-beta/vm/guideInterface.lua @@ -3,7 +3,6 @@ local files = require 'files' local ws = require 'workspace' local guide = require 'parser.guide' local await = require 'await' -local library = require 'library' local config = require 'config' local m = {} @@ -38,9 +37,6 @@ function m.require(args, index) end end - local lib = library.library[reqName] - results[#results+1] = lib - return results end @@ -97,23 +93,6 @@ function vm.interface.link(uri) end function vm.interface.index(obj) - if obj.type == 'library' then - return obj.fields - end - - local tp = obj.type - if tp == 'getglobal' and obj.node.special == '_G' then - local lib = library.global[obj[1]] - if not lib then - return nil - end - tp = lib.value.type - end - local lib = library.object[tp] - if lib then - return lib.fields - end - return nil end diff --git a/script-beta/vm/vm.lua b/script-beta/vm/vm.lua index 90f75b4a..e942d55e 100644 --- a/script-beta/vm/vm.lua +++ b/script-beta/vm/vm.lua @@ -105,9 +105,6 @@ function m.getKeyName(source) if not source then return nil end - if source.type == 'library' then - return 's|' .. source.name - end if source.type == 'call' then local special = m.getSpecial(source.node) if special == 'rawset' |