Skip to content

Commit

Permalink
Raise error if function has duplicate argument names
Browse files Browse the repository at this point in the history
  • Loading branch information
mkruselj committed Jan 9, 2024
1 parent bcfe186 commit 3be7a5a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/ksp_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,10 @@ def modifyFunctionDef(self, node, parent_function = None, function_params = None
node.locals = set() # a set containing the keys in node.locals_name_subst_dict, but all in lowercase
node.used = False

# verify that there are no duplicate argument names in the function definition
if len(set(node.parameters)) > 0:
raise ksp_ast.ParseException(node, "Function contains duplicate argument names!")

# as we visit the function definition, pass along information to nodes further down the tree of the function parameter names
params = function_params + node.parameters

Expand Down

0 comments on commit 3be7a5a

Please sign in to comment.