diff options
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/undefined-global.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua index 75a43d0f..5d647993 100644 --- a/script/core/diagnostics/undefined-global.lua +++ b/script/core/diagnostics/undefined-global.lua @@ -5,6 +5,13 @@ local config = require 'config' local guide = require 'parser.guide' local define = require 'proto.define' +local requireLike = { + ['include'] = true, + ['import'] = true, + ['require'] = true, + ['load'] = true, +} + return function (uri, callback) local ast = files.getAst(uri) if not ast then @@ -20,8 +27,14 @@ return function (uri, callback) if config.config.diagnostics.globals[key] then return end + if config.config.runtime.special[key] then + return + end if #vm.getGlobalSets(key) == 0 then local message = lang.script('DIAG_UNDEF_GLOBAL', key) + if requireLike[key:lower()] then + message = ('%s(%s)'):format(message, lang.script('DIAG_REQUIRE_LIKE', key)) + end callback { start = src.start, finish = src.finish, |