diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/core/diagnostics/undefined-global.lua | 38 | ||||
-rw-r--r-- | script/vm/getDocs.lua | 17 |
2 files changed, 43 insertions, 12 deletions
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua index 778fc1f1..c07c3570 100644 --- a/script/core/diagnostics/undefined-global.lua +++ b/script/core/diagnostics/undefined-global.lua @@ -3,6 +3,7 @@ local vm = require 'vm' local lang = require 'language' local config = require 'config' local guide = require 'parser.guide' +local define = require 'proto.define' return function (uri, callback) local ast = files.getAst(uri) @@ -19,22 +20,39 @@ return function (uri, callback) if config.config.diagnostics.globals[key] then return end - if #vm.getGlobalSets(guide.getKeyName(src)) > 0 then + if #vm.getGlobalSets(guide.getKeyName(src)) == 0 then + local message = lang.script('DIAG_UNDEF_GLOBAL', key) + callback { + start = src.start, + finish = src.finish, + message = message, + } return end - local message = lang.script('DIAG_UNDEF_GLOBAL', key) - -- TODO check other version - local otherVersion - local customVersion - if otherVersion then - message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version)) - elseif customVersion then - message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_CUSTOM', table.concat(customVersion, '/'))) + if not vm.isDeprecated(src, 'deep') then + return end + + do return end + callback { start = src.start, finish = src.finish, - message = message, + tags = { define.DiagnosticTag.Deprecated }, + message = 'adsad', } + + do return end + + local defs = vm.getDefs(src, 'deep') + local versions = {} + for _, def in ipairs(defs) do + + end + -- TODO check other version + local otherVersion + if otherVersion then + message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version)) + end end) end diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index 842b089d..a620fd0f 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -161,6 +161,19 @@ local function isDeprecated(value) return false end -function vm.isDeprecated(value) - return isDeprecated(value) +function vm.isDeprecated(value, deep) + if deep then + local defs = vm.getDefs(value, 'deep') + if #defs == 0 then + return false + end + for _, def in ipairs(defs) do + if not isDeprecated(def) then + return false + end + end + return true + else + return isDeprecated(value) + end end |