summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/diagnostics/circle-doc-class.lua3
-rw-r--r--script/core/diagnostics/duplicate-doc-class.lua3
-rw-r--r--script/core/diagnostics/duplicate-set-field.lua2
-rw-r--r--script/core/diagnostics/undefined-field.lua10
-rw-r--r--script/parser/luadoc.lua6
5 files changed, 18 insertions, 6 deletions
diff --git a/script/core/diagnostics/circle-doc-class.lua b/script/core/diagnostics/circle-doc-class.lua
index 3a94da10..d2e26378 100644
--- a/script/core/diagnostics/circle-doc-class.lua
+++ b/script/core/diagnostics/circle-doc-class.lua
@@ -2,6 +2,7 @@ local files = require 'files'
local searcher = require 'core.searcher'
local lang = require 'language'
local vm = require 'vm'
+local guide = require 'parser.guide'
return function (uri, callback)
local state = files.getAst(uri)
@@ -18,7 +19,7 @@ return function (uri, callback)
if not doc.extends then
goto CONTINUE
end
- local myName = searcher.getKeyName(doc)
+ local myName = guide.getKeyName(doc)
local list = { doc }
local mark = {}
for i = 1, 999 do
diff --git a/script/core/diagnostics/duplicate-doc-class.lua b/script/core/diagnostics/duplicate-doc-class.lua
index 953fa047..daecb836 100644
--- a/script/core/diagnostics/duplicate-doc-class.lua
+++ b/script/core/diagnostics/duplicate-doc-class.lua
@@ -2,6 +2,7 @@ local files = require 'files'
local searcher = require 'core.searcher'
local lang = require 'language'
local vm = require 'vm'
+local guide = require 'parser.guide'
return function (uri, callback)
local state = files.getAst(uri)
@@ -17,7 +18,7 @@ return function (uri, callback)
for _, doc in ipairs(state.ast.docs) do
if doc.type == 'doc.class'
or doc.type == 'doc.alias' then
- local name = searcher.getKeyName(doc)
+ local name = guide.getKeyName(doc)
if not cache[name] then
local docs = vm.getDocDefines(name)
cache[name] = {}
diff --git a/script/core/diagnostics/duplicate-set-field.lua b/script/core/diagnostics/duplicate-set-field.lua
index 7b1718ec..e1883fe5 100644
--- a/script/core/diagnostics/duplicate-set-field.lua
+++ b/script/core/diagnostics/duplicate-set-field.lua
@@ -47,7 +47,7 @@ return function (uri, callback)
end
local blocks = {}
for _, value in ipairs(values) do
- local block = searcher.getBlock(value)
+ local block = guide.getBlock(value)
if not blocks[block] then
blocks[block] = {}
end
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua
index 851e7c3d..2d357d5b 100644
--- a/script/core/diagnostics/undefined-field.lua
+++ b/script/core/diagnostics/undefined-field.lua
@@ -5,6 +5,13 @@ local config = require 'config'
local guide = require 'parser.guide'
local define = require 'proto.define'
+local SkipCheckClass = {
+ ['unknown'] = true,
+ ['any'] = true,
+ ['table'] = true,
+ ['nil'] = true,
+}
+
return function (uri, callback)
local ast = files.getAst(uri)
if not ast then
@@ -95,7 +102,8 @@ return function (uri, callback)
local defs = vm.getDefs(node)
local ok
for _, def in ipairs(defs) do
- if def.type == 'doc.class.name' then
+ if def.type == 'doc.class.name'
+ and not SkipCheckClass[def[1]] then
ok = true
break
end
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 34705072..335c8f24 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -1189,8 +1189,10 @@ local function bindClassAndFields(binded)
end
class = doc
elseif doc.type == 'doc.field' then
- class.fields[#class.fields+1] = doc
- doc.class = class
+ if class then
+ class.fields[#class.fields+1] = doc
+ doc.class = class
+ end
end
end
end