Skip to content

Commit

Permalink
chore: fix dead parameter usages (#3575)
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 authored Aug 31, 2023
1 parent c28f14f commit 6ea56a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions vyper/codegen/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,7 @@ def parse_Call(self):
elif isinstance(self.expr._metadata["type"], StructT):
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"]
)
return Expr.struct_literals(args[0], self.context, self.expr._metadata["type"])

# Interface assignment. Bar(<address>).
elif isinstance(self.expr._metadata["type"], InterfaceT):
Expand Down Expand Up @@ -733,7 +731,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 6ea56a6

Please sign in to comment.