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_alias.py
  3. 4
      slither/core/solidity_types/type_information.py
  4. 3
      slither/core/solidity_types/user_defined_type.py

@ -29,7 +29,6 @@ class ArrayType(Type):
def type(self) -> Type: def type(self) -> Type:
return self._type return self._type
@property @property
def is_dynamic(self) -> bool: def is_dynamic(self) -> bool:
return self.length is None return self.length is None

@ -15,7 +15,6 @@ class TypeAlias(Type):
self.name = name self.name = name
self.underlying_type = underlying_type self.underlying_type = underlying_type
@property @property
def storage_size(self) -> Tuple[int, bool]: def storage_size(self) -> Tuple[int, bool]:
return self.underlying_type.storage_size return self.underlying_type.storage_size
@ -27,6 +26,7 @@ class TypeAlias(Type):
def is_dynamic(self) -> bool: def is_dynamic(self) -> bool:
return self.underlying_type.is_dynamic return self.underlying_type.is_dynamic
class TypeAliasTopLevel(TypeAlias, TopLevel): class TypeAliasTopLevel(TypeAlias, TopLevel):
def __init__(self, underlying_type: Type, name: str, scope: "FileScope"): def __init__(self, underlying_type: Type, name: str, scope: "FileScope"):
super().__init__(underlying_type, name) super().__init__(underlying_type, name)

@ -35,6 +35,10 @@ class TypeInformation(Type):
""" """
return 32, True return 32, True
@property
def is_dynamic(self) -> bool:
raise NotImplementedError
def __str__(self): def __str__(self):
return f"type({self.type.name})" return f"type({self.type.name})"

@ -22,13 +22,12 @@ class UserDefinedType(Type):
@property @property
def is_dynamic(self) -> bool: def is_dynamic(self) -> bool:
raise NotImplemented return False
@property @property
def type(self) -> Union["Contract", "Enum", "Structure"]: def type(self) -> Union["Contract", "Enum", "Structure"]:
return self._type return self._type
@property @property
def storage_size(self) -> Tuple[int, bool]: def storage_size(self) -> Tuple[int, bool]:
from slither.core.declarations.structure import Structure from slither.core.declarations.structure import Structure

Loading…
Cancel
Save