From e44d4b79e08cccd0f8c83c5bf564ce571395acc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 30 Nov 2018 16:24:15 +0800 Subject: =?UTF-8?q?=E7=94=A8=E4=B8=80=E4=B8=AA=E9=A2=9D=E5=A4=96=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=9D=A5=E8=AE=B0=E5=BD=95meta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/matcher/definition.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'server/src/matcher') diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 2a816cf0..045f8171 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -15,6 +15,9 @@ function mt:getVar(key, source) if not var then var = self:addField(self:getVar '_ENV', key, source) end + while var and var.meta do + var = var.meta + end return var end @@ -38,8 +41,8 @@ function mt:createLocal(key, source) return var end -function mt:bindLocal(key, other_key, source) - self.env.var[key] = self:getVar(other_key, source) +function mt:setMeta(var, meta_var) + var.meta = meta_var end function mt:addField(parent, key, source) @@ -218,7 +221,9 @@ function mt:markSimple(simple) local obj = simple[i] local tp = obj.type if tp == ':' then - self:bindLocal('self', simple[i-1][1], simple[i-1]) + local var = self:createLocal('self', simple[i-1]) + local meta_var = self:getVar(simple[i-1][1]) + self:setMeta(var, meta_var) elseif tp == 'name' then if not obj.index then var = self:addField(var, obj[1], obj) -- cgit v1.2.3