feat(py) Add *args and **kwargs support (#71)

This commit is contained in:
danymat
2022-02-22 21:08:38 +01:00
parent 2936644b9d
commit 3ac1e14138
5 changed files with 29 additions and 2 deletions

View File

@@ -30,7 +30,6 @@ return {
node_type = "parameters",
subtree = {
{ retrieve = "all", node_type = "identifier", extract = true },
{
retrieve = "all",
node_type = "default_parameter",
@@ -48,6 +47,18 @@ return {
extract = true,
subtree = { { retrieve = "all", node_type = "identifier", extract = true } },
},
{
retrieve = "first",
node_type = "list_splat_pattern",
extract = true,
as = i.ArbitraryArgs,
},
{
retrieve = "first",
node_type = "dictionary_splat_pattern",
extract = true,
as = i.ArbitraryArgs,
},
},
},
{
@@ -120,6 +131,8 @@ return {
results[i.HasReturn] = (res.return_statement or res.anonymous_return or res[i.ReturnTypeHint])
and { true }
or nil
results[i.ArbitraryArgs] = res[i.ArbitraryArgs]
results[i.Kwargs] = res[i.Kwargs]
return results
end,
},