diff options
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/guide.lua | 4 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 3 | ||||
-rw-r--r-- | script/parser/newparser.lua | 21 |
3 files changed, 15 insertions, 13 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index c4b0b1db..c0f33c28 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -21,7 +21,6 @@ local type = type ---@field specials parser.object[] ---@field labels parser.object[] ---@field node parser.object ----@field dummy boolean ---@field field parser.object ---@field method parser.object ---@field index parser.object @@ -833,6 +832,7 @@ end local isSetMap = { ['setglobal'] = true, ['local'] = true, + ['self'] = true, ['setlocal'] = true, ['setfield'] = true, ['setmethod'] = true, @@ -931,6 +931,7 @@ function m.getKeyName(obj) or tp == 'setglobal' then return obj[1] elseif tp == 'local' + or tp == 'self' or tp == 'getlocal' or tp == 'setlocal' then return obj[1] @@ -999,6 +1000,7 @@ function m.getKeyType(obj) or tp == 'setglobal' then return 'string' elseif tp == 'local' + or tp == 'self' or tp == 'getlocal' or tp == 'setlocal' then return 'local' diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index bbfd3ab4..22a2df1b 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1367,6 +1367,7 @@ local function bindDocsBetween(sources, binded, bindSources, start, finish) end if src.start >= start then if src.type == 'local' + or src.type == 'self' or src.type == 'setglobal' or src.type == 'tablefield' or src.type == 'tableindex' @@ -1437,7 +1438,7 @@ end local bindDocAccept = { 'local' , 'setlocal' , 'setglobal', 'setfield' , 'setmethod' , 'setindex' , - 'tablefield', 'tableindex', + 'tablefield', 'tableindex', 'self' , 'function' , 'table' , '...' , } diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index 5245b94d..ea4ad2c7 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -1749,15 +1749,15 @@ local function addDummySelf(node, call) parent = call, } end - local newNode = {} - for k, v in next, call.node.node do - newNode[k] = v - end - newNode.mirror = call.node.node - newNode.dummy = true - newNode.parent = call.args - call.node.node.mirror = newNode - tinsert(call.args, 1, newNode) + local self = createLocal { + start = node.colon.start, + finish = node.colon.finish, + method = node, + parent = call.args, + [1] = 'self', + } + self.type = 'self' + tinsert(call.args, 1, self) end local function parseSimple(node, funcName) @@ -2303,10 +2303,9 @@ local function parseFunction(isLocal, isAction) finish = funcRight, method = func.name, parent = params, - tag = 'self', - dummy = true, [1] = 'self', } + params[1].type = 'self' end end if hasLeftParen then |