-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improve literals parsing and Constant conversion:
- add bool type to constant - convert integer using 'e' (1e10) - convert constant uint -> int when possible - Api added: - Constant.original_value: str version of the constant expression - Structure.elems_ordered: keep original structure declaration order
- Loading branch information
Showing
13 changed files
with
189 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from slither.core.solidity_types import (ArrayType, MappingType, ElementaryType) | ||
|
||
def _add_mapping_parameter(t, l): | ||
while isinstance(t, MappingType): | ||
l.append(t.type_from) | ||
t = t.type_to | ||
_add_array_parameter(t, l) | ||
|
||
def _add_array_parameter(t, l): | ||
while isinstance(t, ArrayType): | ||
l.append(ElementaryType('uint256')) | ||
t = t.type | ||
|
||
def export_nested_types_from_variable(variable): | ||
""" | ||
Export the list of nested types (mapping/array) | ||
:param variable: | ||
:return: list(Type) | ||
""" | ||
l = [] | ||
if isinstance(variable.type, MappingType): | ||
t = variable.type | ||
_add_mapping_parameter(t, l) | ||
|
||
if isinstance(variable.type, ArrayType): | ||
v = variable | ||
_add_array_parameter(v.type, l) | ||
|
||
return l | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters