diff options
-rw-r--r-- | server-beta/src/searcher/getGlobal.lua | 6 | ||||
-rw-r--r-- | server-beta/src/searcher/getGlobals.lua | 2 | ||||
-rw-r--r-- | server-beta/src/searcher/getLibrary.lua | 13 | ||||
-rw-r--r-- | server-beta/src/searcher/init.lua | 2 | ||||
-rw-r--r-- | server-beta/src/searcher/isGlobal.lua | 7 | ||||
-rw-r--r-- | server-beta/src/searcher/searcher.lua | 2 |
6 files changed, 14 insertions, 18 deletions
diff --git a/server-beta/src/searcher/getGlobal.lua b/server-beta/src/searcher/getGlobal.lua new file mode 100644 index 00000000..226f2473 --- /dev/null +++ b/server-beta/src/searcher/getGlobal.lua @@ -0,0 +1,6 @@ +local searcher = require 'searcher.searcher' + +function searcher.getGlobal(source) + searcher.getGlobals(source) + return searcher.cache.getGlobal[source] +end diff --git a/server-beta/src/searcher/getGlobals.lua b/server-beta/src/searcher/getGlobals.lua index ea6a6f6c..13e69e16 100644 --- a/server-beta/src/searcher/getGlobals.lua +++ b/server-beta/src/searcher/getGlobals.lua @@ -23,7 +23,7 @@ local function getGlobals(root) end cache[name][#cache[name]+1] = info cache[name].mode[info.mode] = true - searcher.cache.isGlobal[src] = true + searcher.cache.getGlobal[src] = name end) return cache end diff --git a/server-beta/src/searcher/getLibrary.lua b/server-beta/src/searcher/getLibrary.lua index 062c8937..afedde64 100644 --- a/server-beta/src/searcher/getLibrary.lua +++ b/server-beta/src/searcher/getLibrary.lua @@ -3,16 +3,13 @@ local guide = require 'parser.guide' local library = require 'library' local function getLibrary(source) - local name = guide.getKeyName(source) - if not name then + local globalName = searcher.getGlobal(source) + if not globalName then return nil end - local sname = name:match '^s|(.+)$' - if not sname then - return nil - end - if searcher.isGlobal(source) then - return library.global[sname] + local name = globalName:match '^s|(.+)$' + if library.global[name] then + return library.global[name] end return nil end diff --git a/server-beta/src/searcher/init.lua b/server-beta/src/searcher/init.lua index a0e61999..6ec7bc99 100644 --- a/server-beta/src/searcher/init.lua +++ b/server-beta/src/searcher/init.lua @@ -4,6 +4,6 @@ require 'searcher.eachRef' require 'searcher.eachDef' require 'searcher.getGlobals' require 'searcher.getLinks' -require 'searcher.isGlobal' +require 'searcher.getGlobal' require 'searcher.getLibrary' return searcher diff --git a/server-beta/src/searcher/isGlobal.lua b/server-beta/src/searcher/isGlobal.lua deleted file mode 100644 index 8c59dadb..00000000 --- a/server-beta/src/searcher/isGlobal.lua +++ /dev/null @@ -1,7 +0,0 @@ -local searcher = require 'searcher.searcher' -local guide = require 'parser.guide' - -function searcher.isGlobal(source) - local globals = searcher.getGlobals(source) - return searcher.cache.isGlobal[source] == true -end diff --git a/server-beta/src/searcher/searcher.lua b/server-beta/src/searcher/searcher.lua index c6038f89..19e114d6 100644 --- a/server-beta/src/searcher/searcher.lua +++ b/server-beta/src/searcher/searcher.lua @@ -61,7 +61,7 @@ function m.refreshCache() eachField = {}, getGlobals = {}, getLinks = {}, - isGlobal = {}, + getGlobal = {}, specialName = {}, getLibrary = {}, specials = nil, |