diff options
-rw-r--r-- | .luarc.json | 1 | ||||
-rw-r--r-- | script/core/semantic-tokens.lua | 1 | ||||
-rw-r--r-- | script/parser/newparser.lua | 2 | ||||
-rw-r--r-- | script/vm/compiler.lua | 8 |
4 files changed, 8 insertions, 4 deletions
diff --git a/.luarc.json b/.luarc.json index eccd4f18..7be0e621 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,5 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "diagnostics": { "disable": [ "close-non-object" diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 04e36cd0..5917a1a3 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -92,6 +92,7 @@ local Care = util.switch() } end) : case 'local' + : case 'self' : case 'getlocal' : case 'setlocal' : call(function (source, options, results) diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index ea4ad2c7..8b5e6ee8 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -1752,7 +1752,6 @@ local function addDummySelf(node, call) local self = createLocal { start = node.colon.start, finish = node.colon.finish, - method = node, parent = call.args, [1] = 'self', } @@ -2301,7 +2300,6 @@ local function parseFunction(isLocal, isAction) params[1] = createLocal { start = funcRight, finish = funcRight, - method = func.name, parent = params, [1] = 'self', } diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 708b4e12..bbc6a333 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -731,7 +731,13 @@ local function compileLocalBase(source) local hasMarkParam if source.type == 'self' and not hasMarkDoc then hasMarkParam = true - vm.setNode(source, vm.compileNode(source.method.node)) + if source.parent.parent.type == 'call' then + -- obj:func(...) + vm.setNode(source, vm.compileNode(source.parent.parent.node.node)) + else + -- function obj:func(...) + vm.setNode(source, vm.compileNode(source.parent.parent.parent.node)) + end end local hasMarkValue if source.value then |