From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Sergey Bronnikov <estetus@gmail.com>, tarantool-patches@dev.tarantool.org Cc: o.piskunov@tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2 1/6] Fix luacheck warnings in src/lua/ Date: Sat, 11 Apr 2020 18:54:40 +0200 [thread overview] Message-ID: <70f13a2e-6c41-abfd-7108-05b6f1098c19@tarantool.org> (raw) In-Reply-To: <2211143d95d0385682f79fb632bd7fd84c442c23.1586341316.git.sergeyb@tarantool.org> Thanks for the patch! > diff --git a/src/lua/swim.lua b/src/lua/swim.lua > index 0859915c9..466e77ce4 100644 > --- a/src/lua/swim.lua > +++ b/src/lua/swim.lua > @@ -782,20 +782,20 @@ local swim_member_event_mt = { > -- > -- Create a closure function for preprocessing raw SWIM member > -- event trigger parameters. > --- @param s SWIM instance. > +-- @param instance SWIM instance. luacheck reported shadowing of 's' in the cycle below, so it is enough to fix the cycle. I fixed that in a separate commit. Squash it if you agree. > -- @param callback User functions to call. > -- @param ctx An optional parameter for @a callback passed as is. > -- @return A function to set as a trigger. > -- > -local function swim_on_member_event_new(s, callback, ctx) > +local function swim_on_member_event_new(instance, callback, ctx) > -- Do not keep a hard reference to a SWIM instance. Otherwise > -- it is a cyclic reference, and both the instance and the > -- trigger will never be GC-ed. > - s = setmetatable({s}, {__mode = 'v'}) > + instance = setmetatable({instance}, {__mode = 'v'}) > return function(member_ptr, event_mask) > - local s = s[1] > - if s then > - local m = swim_wrap_member(s, member_ptr) > + local i = instance[1] > + if i then > + local m = swim_wrap_member(i, member_ptr) > local event = setmetatable({event_mask}, swim_member_event_mt) > return callback(m, event, ctx) > end See diff below and in a separate commit on the branch. ==================== diff --git a/src/lua/swim.lua b/src/lua/swim.lua index 466e77ce4..8e3b0ab13 100644 --- a/src/lua/swim.lua +++ b/src/lua/swim.lua @@ -782,20 +782,20 @@ local swim_member_event_mt = { -- -- Create a closure function for preprocessing raw SWIM member -- event trigger parameters. --- @param instance SWIM instance. +-- @param s SWIM instance. -- @param callback User functions to call. -- @param ctx An optional parameter for @a callback passed as is. -- @return A function to set as a trigger. -- -local function swim_on_member_event_new(instance, callback, ctx) +local function swim_on_member_event_new(s, callback, ctx) -- Do not keep a hard reference to a SWIM instance. Otherwise -- it is a cyclic reference, and both the instance and the -- trigger will never be GC-ed. - instance = setmetatable({instance}, {__mode = 'v'}) + s = setmetatable({s}, {__mode = 'v'}) return function(member_ptr, event_mask) - local i = instance[1] - if i then - local m = swim_wrap_member(i, member_ptr) + local si = s[1] + if si then + local m = swim_wrap_member(si, member_ptr) local event = setmetatable({event_mask}, swim_member_event_mt) return callback(m, event, ctx) end diff --git a/src/lua/tap.lua b/src/lua/tap.lua index 04497386e..094eb883f 100644 --- a/src/lua/tap.lua +++ b/src/lua/tap.lua @@ -53,7 +53,6 @@ local function ok(test, cond, message, extra) io.write(string.format("not ok - %s\n", message)) extra = extra or {} if test.trace then - debug.getinfo(3, "Sl") extra.trace = traceback() extra.filename = extra.trace[#extra.trace].filename extra.line = extra.trace[#extra.trace].line
next prev parent reply other threads:[~2020-04-11 16:54 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-08 15:42 [Tarantool-patches] [PATCH v2 0/6] Add static analysis with luacheck Sergey Bronnikov 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 1/6] Fix luacheck warnings in src/lua/ Sergey Bronnikov 2020-04-09 4:31 ` Alexander Tikhonov 2020-04-11 16:54 ` Vladislav Shpilevoy [this message] 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 2/6] Fix luacheck warnings in test/ Sergey Bronnikov 2020-04-09 4:31 ` Alexander Tikhonov 2020-04-11 16:54 ` Vladislav Shpilevoy 2020-04-14 7:49 ` Sergey Bronnikov 2020-04-11 16:54 ` Vladislav Shpilevoy 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 3/6] Fix luacheck warnings in src/box/lua/ Sergey Bronnikov 2020-04-09 4:29 ` Alexander Tikhonov 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 4/6] Fix luacheck warnings in extra/dist/tarantoolctl.in Sergey Bronnikov 2020-04-09 4:29 ` Alexander Tikhonov 2020-04-09 7:30 ` Oleg Babin 2020-04-10 14:05 ` Sergey Bronnikov 2020-04-15 15:14 ` Igor Munkin 2020-04-15 15:37 ` Igor Munkin 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 5/6] Add luacheck config Sergey Bronnikov 2020-04-09 4:27 ` Alexander Tikhonov 2020-04-11 16:54 ` Vladislav Shpilevoy 2020-04-13 15:16 ` Sergey Bronnikov 2020-04-14 23:29 ` Vladislav Shpilevoy 2020-04-15 8:30 ` Sergey Bronnikov 2020-04-08 15:43 ` [Tarantool-patches] [PATCH v2 6/6] gitlab-ci: enable static analysis with luacheck Sergey Bronnikov 2020-04-09 4:20 ` Alexander Tikhonov 2020-04-10 14:53 ` Sergey Bronnikov 2020-04-22 8:45 ` Alexander Tikhonov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=70f13a2e-6c41-abfd-7108-05b6f1098c19@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=estetus@gmail.com \ --cc=o.piskunov@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 1/6] Fix luacheck warnings in src/lua/' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox