From 8535713d22d4bfc1d02dea1b6fdc31324c61b760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 10 Oct 2019 19:34:12 +0800 Subject: =?UTF-8?q?=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/core/engineer.lua | 40 +++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'server-beta/src/core/engineer.lua') diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua index bfb9c98b..0d55479c 100644 --- a/server-beta/src/core/engineer.lua +++ b/server-beta/src/core/engineer.lua @@ -74,7 +74,14 @@ function mt:eachField(source, key, callback) if not f then return end - f(self, source, key, callback) + local mark = {} + f(self, source, key, function (src, ...) + if mark[src] then + return + end + mark[src] = true + callback(src, ...) + end) end function mt:eachRef(source, callback) @@ -87,7 +94,14 @@ function mt:eachRef(source, callback) if not f then return end - f(self, source, callback) + local mark = {} + f(self, source, function (src, ...) + if mark[src] then + return + end + mark[src] = true + callback(src, ...) + end) end function mt:eachDef(source, callback) @@ -100,7 +114,14 @@ function mt:eachDef(source, callback) if not f then return end - f(self, source, callback) + local mark = {} + f(self, source, function (src, ...) + if mark[src] then + return + end + mark[src] = true + callback(src, ...) + end) end function mt:eachValue(source, callback) @@ -113,7 +134,14 @@ function mt:eachValue(source, callback) if not f then return end - f(self, source, callback) + local mark = {} + f(self, source, function (src, ...) + if mark[src] then + return + end + mark[src] = true + callback(src, ...) + end) end function mt:childDef(source, callback) @@ -155,10 +183,6 @@ function mt:callArgOf(source) return tableUnpack(args) end -function mt:callReturnOf(source) - -end - return function (ast) local self = setmetatable({ step = 0, -- cgit v1.2.3