From de0adfc8ee4561d7eb9c31e19fa5774ff7d999dd Mon Sep 17 00:00:00 2001 From: sumneko Date: Sun, 5 May 2019 21:27:34 +0800 Subject: emmyFunction --- server/src/vm/function.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'server/src/vm/function.lua') diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index 2322fa70..e605e1c9 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -349,15 +349,19 @@ function mt:findEmmyParamByName(name) return nil end +function mt:addArg(name, source, value) + local loc = localMgr.create(name, source, value) + self:saveUpvalue(name, loc) + self.args[#self.args+1] = loc +end + function mt:createArg(vm, arg) vm:instantSource(arg) arg:set('arg', self) if arg.type == 'name' then + vm:instantSource(arg) local value = valueMgr.create('nil', arg) - local loc = localMgr.create(arg[1], arg, value) - self:saveUpvalue(arg[1], loc) - self.args[#self.args+1] = loc - + self:addArg(arg[1], arg, value) elseif arg.type == '...' then self._dots = createMulti() end -- cgit v1.2.3