summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-22 15:54:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-22 15:54:44 +0800
commitb7f7789e46ab8c67d25704be696a1523762b1d80 (patch)
treebfbe4435180d2304487d28655c3fbbf987793714 /script
parenta11c1e47a1bbe1004333143431f901ab8ecde4dd (diff)
downloadlua-language-server-b7f7789e46ab8c67d25704be696a1523762b1d80.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/parser/guide.lua5
-rw-r--r--script/parser/newparser.lua14
-rw-r--r--script/vm/getLinks.lua6
3 files changed, 13 insertions, 12 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 4a0ca21f..fb5f3db4 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -725,10 +725,11 @@ end
--- 获取指定的 special
function m.eachSpecialOf(ast, name, callback)
local root = m.getRoot(ast)
- if not root.specials then
+ local state = root.state
+ if not state.specials then
return
end
- local specials = root.specials[name]
+ local specials = state.specials[name]
if not specials then
return
end
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index de78fd6d..9547a830 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -210,14 +210,13 @@ local parseExp, parseAction
local pushError
local function addSpecial(name, obj)
- local root = State.ast
- if not root.specials then
- root.specials = {}
+ if not State.specials then
+ State.specials = {}
end
- if not root.specials[name] then
- root.specials[name] = {}
+ if not State.specials[name] then
+ State.specials[name] = {}
end
- root.specials[name][#root.specials[name]+1] = obj
+ State.specials[name][#State.specials[name]+1] = obj
obj.special = name
end
@@ -1739,7 +1738,7 @@ local function parseSimple(node, funcName)
}
call.args = args
str.parent = args
- node.parent = args
+ node.parent = call
node = call
elseif CharMapStrLH[token] then
local str = parseLongString()
@@ -3583,6 +3582,7 @@ return function (lua, mode, version, options)
elseif mode == 'Action' then
State.ast = parseAction()
end
+ State.ast.state = State
return State
end
diff --git a/script/vm/getLinks.lua b/script/vm/getLinks.lua
index 161396f6..d2332504 100644
--- a/script/vm/getLinks.lua
+++ b/script/vm/getLinks.lua
@@ -6,12 +6,12 @@ local files = require 'files'
local function getFileLinks(uri)
local ws = require 'workspace'
local links = {}
- local ast = files.getState(uri)
- if not ast then
+ local state = files.getState(uri)
+ if not state then
return links
end
tracy.ZoneBeginN('getFileLinks')
- guide.eachSpecialOf(ast.ast, 'require', function (source)
+ guide.eachSpecialOf(state.ast, 'require', function (source)
local call = source.parent
if not call or call.type ~= 'call' then
return