From 74ae4909ae8b376f382a2480283b7f51a237bd2b Mon Sep 17 00:00:00 2001 From: Josselin Feist Date: Mon, 1 Aug 2022 17:08:45 +0200 Subject: [PATCH] Minor improvements --- slither/core/solidity_types/array_type.py | 1 - slither/core/solidity_types/type.py | 2 +- slither/core/solidity_types/type_alias.py | 2 +- slither/core/solidity_types/type_information.py | 4 ++++ slither/core/solidity_types/user_defined_type.py | 3 +-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/slither/core/solidity_types/array_type.py b/slither/core/solidity_types/array_type.py index 15b53eb03..97d735c89 100644 --- a/slither/core/solidity_types/array_type.py +++ b/slither/core/solidity_types/array_type.py @@ -29,7 +29,6 @@ class ArrayType(Type): def type(self) -> Type: return self._type - @property def is_dynamic(self) -> bool: return self.length is None diff --git a/slither/core/solidity_types/type.py b/slither/core/solidity_types/type.py index bfec7d8bc..c06e5984f 100644 --- a/slither/core/solidity_types/type.py +++ b/slither/core/solidity_types/type.py @@ -18,4 +18,4 @@ class Type(SourceMapping, metaclass=abc.ABCMeta): @property @abc.abstractmethod def is_dynamic(self) -> bool: - """ True if the size of the type is dynamic""" + """True if the size of the type is dynamic""" diff --git a/slither/core/solidity_types/type_alias.py b/slither/core/solidity_types/type_alias.py index 0a1f99d23..703d0f4f6 100644 --- a/slither/core/solidity_types/type_alias.py +++ b/slither/core/solidity_types/type_alias.py @@ -15,7 +15,6 @@ class TypeAlias(Type): self.name = name self.underlying_type = underlying_type - @property def storage_size(self) -> Tuple[int, bool]: return self.underlying_type.storage_size @@ -27,6 +26,7 @@ class TypeAlias(Type): def is_dynamic(self) -> bool: return self.underlying_type.is_dynamic + class TypeAliasTopLevel(TypeAlias, TopLevel): def __init__(self, underlying_type: Type, name: str, scope: "FileScope"): super().__init__(underlying_type, name) diff --git a/slither/core/solidity_types/type_information.py b/slither/core/solidity_types/type_information.py index ccc84e8c1..0477bb7e6 100644 --- a/slither/core/solidity_types/type_information.py +++ b/slither/core/solidity_types/type_information.py @@ -35,6 +35,10 @@ class TypeInformation(Type): """ return 32, True + @property + def is_dynamic(self) -> bool: + raise NotImplementedError + def __str__(self): return f"type({self.type.name})" diff --git a/slither/core/solidity_types/user_defined_type.py b/slither/core/solidity_types/user_defined_type.py index 21f9c0911..38300cdd9 100644 --- a/slither/core/solidity_types/user_defined_type.py +++ b/slither/core/solidity_types/user_defined_type.py @@ -22,13 +22,12 @@ class UserDefinedType(Type): @property def is_dynamic(self) -> bool: - raise NotImplemented + return False @property def type(self) -> Union["Contract", "Enum", "Structure"]: return self._type - @property def storage_size(self) -> Tuple[int, bool]: from slither.core.declarations.structure import Structure