Skip to content

Commit

Permalink
Ensure argument name never matches the function name
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio committed Dec 20, 2024
1 parent 1723f6e commit f1dbe86
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/generator_swig.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ def write_func(writer: Writer, func: Func, name: str, kind: FuncKind) -> None:
if arg_name == "self":
arg_name = "_self"

# if function arg is the same as the function name
# we rename the argument
if arg_name == name:
arg_name += "_arg"

arg_decl = stringify_decl(
arg_name,
arg.ctype,
Expand Down

0 comments on commit f1dbe86

Please sign in to comment.