Skip to content

Commit

Permalink
Merge pull request #817 from crytic/dev-fix-0.8-type-parsing
Browse files Browse the repository at this point in the history
Import type parsing for Solidity 0.8
  • Loading branch information
montyly authored Apr 5, 2021
2 parents 7fe4253 + 61499d6 commit cf07c59
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
description="Slither is a Solidity static analysis framework written in Python 3.",
url="https://github.com/crytic/slither",
author="Trail of Bits",
version="0.7.0",
version="0.7.1",
packages=find_packages(),
python_requires=">=3.6",
install_requires=[
"prettytable>=0.7.2",
"pysha3>=1.0.2",
"crytic-compile>=0.1.12",
"crytic-compile>=0.1.13",
# "crytic-compile",
],
# dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"],
Expand Down
16 changes: 16 additions & 0 deletions slither/solc_parsing/solidity_types/type_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from slither.core.solidity_types.type import Type
from slither.core.solidity_types.user_defined_type import UserDefinedType
from slither.core.variables.function_type_variable import FunctionTypeVariable
from slither.exceptions import SlitherError
from slither.solc_parsing.exceptions import ParsingError

if TYPE_CHECKING:
Expand Down Expand Up @@ -291,6 +292,21 @@ def parse_type(t: Union[Dict, UnknownType], caller_context):
all_enums,
)

# Introduced with Solidity 0.8
if t[key] == "IdentifierPath":
if is_compact_ast:
return _find_from_type_name(
t["name"],
functions,
contracts,
structures_direct_access,
all_structures,
enums_direct_access,
all_enums,
)

raise SlitherError("Solidity 0.8 not supported with the legacy AST")

if t[key] == "ArrayTypeName":
length = None
if is_compact_ast:
Expand Down

0 comments on commit cf07c59

Please sign in to comment.