From b4e36a946a42a35d49290e095ff044f2ffa051e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jan 2019 18:02:53 +0800 Subject: =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=87=BD=E6=95=B0=E6=97=B6=E8=A6=81?= =?UTF-8?q?=E6=88=AA=E6=96=AD=E8=B0=83=E7=94=A8=E5=A4=84=E7=9A=84=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/vm.lua | 1 + server/test/diagnostics/init.lua | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index e649ecc7..8359c470 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -288,6 +288,7 @@ function mt:runFunction(func) self.chunk:cut 'locals' self.chunk.func = func + self.scope:cut 'locals' for name, loc in pairs(func.upvalues) do self.scope.locals[name] = loc end diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index acaf3249..9df92961 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -158,3 +158,11 @@ local function f() end f() ]] + +TEST [[ +local function f(var) + print(var) +end +local var +f(var) +]] -- cgit v1.2.3