summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-08 19:26:21 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-08 19:26:21 +0800
commit4fcc1fda1276fad2daf6c09e2ffddc8c01206aae (patch)
tree27ccf5c242e17e83aa208239f0b545eec3ef8fe9 /server/src
parentd52bd13cb560abf9711412b759212f8845970139 (diff)
downloadlua-language-server-4fcc1fda1276fad2daf6c09e2ffddc8c01206aae.zip
pcall一下
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/compile.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/server/src/matcher/compile.lua b/server/src/matcher/compile.lua
index b9bd4b6d..7db5ad4b 100644
--- a/server/src/matcher/compile.lua
+++ b/server/src/matcher/compile.lua
@@ -586,10 +586,7 @@ function mt:searchActions(actions)
return nil
end
-return function (ast)
- if not ast then
- return nil
- end
+local function compile(ast)
local searcher = setmetatable({
env = env {
var = {},
@@ -608,3 +605,14 @@ return function (ast)
return searcher.results
end
+
+return function (ast)
+ if not ast then
+ return nil
+ end
+ local suc, res = xpcall(compile, log.error, ast)
+ if not suc then
+ return nil
+ end
+ return res
+end