Use full_name for solidity signature in case of internal function

Hotfix to support recursive type
pull/1356/head
Josselin Feist 2 years ago
parent d8e526e53f
commit 085b60913a
  1. 18
      slither/core/declarations/function.py

@ -962,10 +962,28 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu
:return: the solidity signature
"""
if self._solidity_signature is None:
# Solidity allows recursive type for structure definition if its not used in public /external
# When this happens we can reach an infinite loop in convert_type_for_solidity_signature_to_string
# A quick workaround is to just return full_name for internal
# contract A{
#
# struct St{
# St[] a;
# uint b;
# }
#
# function f(St memory s) internal{
#
# }
#
# }
if self.visibility in ["public", "external"]:
parameters = [
convert_type_for_solidity_signature_to_string(x.type) for x in self.parameters
]
self._solidity_signature = self.name + "(" + ",".join(parameters) + ")"
else:
self._solidity_signature = self.full_name
return self._solidity_signature
@property

Loading…
Cancel
Save