Skip to content

Commit

Permalink
chore: fix dead parameter usages
Browse files Browse the repository at this point in the history
`_is_function_implemented` did not use its parameter `fn_name`, it used
the captured `name` variable, which happened to be the same as
`fn_name`.

chainsec june 2023 review 6.2
  • Loading branch information
charles-cooper committed Aug 29, 2023
1 parent 43c8d85 commit d627fc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions vyper/codegen/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def parse_Call(self):
args = self.expr.args
if len(args) == 1 and isinstance(args[0], vy_ast.Dict):
return Expr.struct_literals(
args[0], function_name, self.context, self.expr._metadata["type"]
args[0], self.context, self.expr._metadata["type"]
)

# Interface assignment. Bar(<address>).
Expand Down Expand Up @@ -733,7 +733,7 @@ def parse_IfExp(self):
return IRnode.from_list(["if", test, body, orelse], typ=typ, location=location)

@staticmethod
def struct_literals(expr, name, context, typ):
def struct_literals(expr, context, typ):
member_subs = {}
member_typs = {}
for key, value in zip(expr.keys, expr.values):
Expand Down
6 changes: 3 additions & 3 deletions vyper/semantics/types/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ def validate_implements(self, node: vy_ast.ImplementsDecl) -> None:

def _is_function_implemented(fn_name, fn_type):
vyper_self = namespace["self"].typ
if name not in vyper_self.members:
if fn_name not in vyper_self.members:
return False
s = vyper_self.members[name]
s = vyper_self.members[fn_name]
if isinstance(s, ContractFunctionT):
to_compare = vyper_self.members[name]
to_compare = vyper_self.members[fn_name]
# this is kludgy, rework order of passes in ModuleNodeVisitor
elif isinstance(s, VarInfo) and s.is_public:
to_compare = s.decl_node._metadata["func_type"]
Expand Down

0 comments on commit d627fc1

Please sign in to comment.