Minor improvements

pull/1175/head
Josselin Feist 2 years ago
parent 879157cfc1
commit 74ae4909ae
  1. 1
      slither/core/solidity_types/array_type.py
  2. 2
      slither/core/solidity_types/type.py
  3. 2
      slither/core/solidity_types/type_alias.py
  4. 4
      slither/core/solidity_types/type_information.py
  5. 3
      slither/core/solidity_types/user_defined_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

@ -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"""

@ -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)

@ -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})"

@ -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

Loading…
Cancel
Save