Skip to content

Commit

Permalink
style(dynamic_hook): rename the third argument of function `hook_func…
Browse files Browse the repository at this point in the history
…tion` from `child_key` to `function_key` for readability

Co-authored-by: samugi <[email protected]>
  • Loading branch information
ADD-SP and samugi committed May 27, 2024
1 parent 9b8c63f commit b499955
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kong/dynamic_hook/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,24 @@ local function wrap_function(max_args, group_name, original_func, handlers)
end


function _M.hook_function(group_name, parent, child_key, max_args, handlers)
function _M.hook_function(group_name, parent, function_key, max_args, handlers)
assert(type(group_name) == "string", "group_name must be a string")
assert(type(parent) == "table", "parent must be a table")
assert(type(child_key) == "string", "child_key must be a string")
assert(type(function_key) == "string", "function_key must be a string")

local is_varargs = max_args == "varargs"
if not is_varargs then
assert(type(max_args) == "number", 'max_args must be a number or "varargs"')
assert(max_args >= 0 and max_args <= 8, 'max_args must be >= 0 and <= 8, or "varargs"')
end

local original_func = parent[child_key]
assert(type(original_func) == "function", "parent[" .. child_key .. "] must be a function")
local original_func = parent[function_key]
assert(type(original_func) == "function", "parent[" .. function_key .. "] must be a function")

if is_varargs then
parent[child_key] = wrap_function_vararg(group_name, original_func, handlers)
parent[function_key] = wrap_function_vararg(group_name, original_func, handlers)
else
parent[child_key] = wrap_function(max_args, group_name, original_func, handlers)
parent[function_key] = wrap_function(max_args, group_name, original_func, handlers)
end
end

Expand Down

1 comment on commit b499955

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:b4999557d6d9df4684e5236b6fd1bd4f14142548
Artifacts available https://github.com/Kong/kong/actions/runs/9252110478

Please sign in to comment.