summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/noder.lua3
-rw-r--r--script/core/searcher.lua3
-rw-r--r--test/full/init.lua1
-rw-r--r--test/full/projects.lua36
-rw-r--r--test/full/self.lua6
5 files changed, 47 insertions, 2 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 428cba26..9bb2b9b5 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -439,6 +439,9 @@ function m.compileNode(noders, source)
if func.isGeneric then
return
end
+ if source.parent.type ~= 'funcargs' then
+ return
+ end
local setmethod = func.parent
-- guess `self`
if setmethod and ( setmethod.type == 'setmethod'
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 52b0b5ea..2b4b4caa 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -6,6 +6,7 @@ local ws = require 'workspace'
local vm = require 'vm.vm'
local globals = require 'vm.globals'
local docs = require 'vm.docs'
+local await = require 'await'
local NONE = {'NONE'}
local LAST = {'LAST'}
@@ -185,7 +186,7 @@ local function crossSearch(status, uri, expect, mode)
return
end
status.lock[uri] = true
- --await.delay()
+ await.delay()
if TRACE then
log.debug('crossSearch', uri, expect)
end
diff --git a/test/full/init.lua b/test/full/init.lua
index ad34da7d..f292a573 100644
--- a/test/full/init.lua
+++ b/test/full/init.lua
@@ -11,4 +11,5 @@ end
require 'full.normal'
require 'full.example'
require 'full.dirty'
+require 'full.projects'
require 'full.self'
diff --git a/test/full/projects.lua b/test/full/projects.lua
new file mode 100644
index 00000000..fa70505c
--- /dev/null
+++ b/test/full/projects.lua
@@ -0,0 +1,36 @@
+local files = require 'files'
+local fsu = require 'fs-utility'
+local furi = require 'file-uri'
+local diag = require 'provider.diagnostic'
+local config = require 'config'
+local ws = require 'workspace'
+local fs = require 'bee.filesystem'
+files.removeAll()
+
+local path = fs.path [[C:\W3-Server\script]]
+
+fsu.scanDirectory(path, function (path)
+ if path:extension():string() ~= '.lua' then
+ return
+ end
+ local uri = furi.encode(path:string())
+ local text = fsu.loadFile(path)
+ files.setText(uri, text)
+ files.open(uri)
+end)
+
+print('基准诊断目录:', path)
+
+ws.ready = true
+diag.start()
+
+local clock = os.clock()
+
+for uri in files.eachFile() do
+ local fileClock = os.clock()
+ diag.doDiagnostic(uri)
+ print('诊断文件耗时:', os.clock() - fileClock, uri)
+end
+
+local passed = os.clock() - clock
+print('基准全量诊断用时:', passed)
diff --git a/test/full/self.lua b/test/full/self.lua
index 9a26cb04..63e76d9a 100644
--- a/test/full/self.lua
+++ b/test/full/self.lua
@@ -6,7 +6,9 @@ local config = require 'config'
local ws = require 'workspace'
files.removeAll()
-fsu.scanDirectory(ROOT, function (path)
+local path = ROOT
+
+fsu.scanDirectory(path, function (path)
if path:extension():string() ~= '.lua' then
return
end
@@ -16,6 +18,8 @@ fsu.scanDirectory(ROOT, function (path)
files.open(uri)
end)
+print('基准诊断目录:', path)
+
ws.ready = true
diag.start()