From 45b8a1d0cb6e0a7fc160a4fc0a4a47469bbac1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 16 Nov 2020 14:18:48 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B0=86=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E8=AF=86=E5=88=AB=E4=B8=BAspecial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 2 +- script-beta/parser/compile.lua | 9 +++++++++ script-beta/vm/getLibrary.lua | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e1fa7d8..62923b5d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -48,7 +48,7 @@ "type": "lua", "request": "attach", "stopOnEntry": true, - "address": "127.0.0.1:11409", + "address": "127.0.0.1:11427", "outputCapture": [ ] }, diff --git a/script-beta/parser/compile.lua b/script-beta/parser/compile.lua index f2a78c28..2c7172e8 100644 --- a/script-beta/parser/compile.lua +++ b/script-beta/parser/compile.lua @@ -212,6 +212,15 @@ local vmMap = { if node then addRef(node, obj) end + local name = obj[1] + if specials[name] then + addSpecial(name, obj) + elseif Options and Options.special then + local asName = Options.special[name] + if specials[asName] then + addSpecial(asName, obj) + end + end end end, ['local'] = function (obj) diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index 86f1ae58..eaeeafa3 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -60,6 +60,12 @@ function vm.getLibraryName(source, deep) if lib then return lib.name end + local defs = vm.getDefs(source, deep) + for _, def in ipairs(defs) do + if def.special then + return def.special + end + end return nil end -- cgit v1.2.3