From 669e20ef2cdfa8d7763f7e7bcd405986e665e526 Mon Sep 17 00:00:00 2001 From: sumneko Date: Wed, 24 Apr 2019 21:16:16 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0emmyParam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/emmy.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'server/src/vm/emmy.lua') diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua index a2a38553..5406aab1 100644 --- a/server/src/vm/emmy.lua +++ b/server/src/vm/emmy.lua @@ -2,6 +2,7 @@ local mt = require 'vm.manager' function mt:clearEmmy() self._emmy = nil + self._emmyParams = nil end function mt:doEmmy(action) @@ -13,6 +14,7 @@ function mt:doEmmy(action) elseif tp == 'emmyAlias' then self:doEmmyAlias(action) elseif tp == 'emmyParam' then + self:doEmmyParam(action) elseif tp == 'emmyReturn' then elseif tp == 'emmyField' then elseif tp == 'emmyGeneric' then @@ -33,6 +35,19 @@ function mt:getEmmy() return emmy end +function mt:addEmmyParam(param) + if not self._emmyParams then + self._emmyParams = {} + end + self._emmyParams[#self._emmyParams+1] = param +end + +function mt:getEmmyParams() + local params = self._emmyParams + self._emmyParams = nil + return params +end + function mt:doEmmyClass(action) ---@type emmyMgr local emmyMgr = self.emmyMgr @@ -83,6 +98,18 @@ function mt:doEmmyAlias(action) end end +function mt:doEmmyParam(action) + ---@type emmyMgr + local emmyMgr = self.emmyMgr + self:instantSource(action) + self:instantSource(action[1]) + local type = self:doEmmyType(action[2]) + local param = emmyMgr:addParam(action, type) + action:set('emmy.param', param) + self._emmy = nil + self:addEmmyParam(param) +end + function mt:doEmmyIncomplete(action) self:instantSource(action) end -- cgit v1.2.3