-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the way slither handles top level enum/struct
- Split declaration.Enum/Structure to EnumContract/EnumToplevel (same for structure) - Update the parsing accordingly
- Loading branch information
Showing
34 changed files
with
246 additions
and
171 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from slither.core.children.child_contract import ChildContract | ||
from slither.core.declarations import Enum | ||
|
||
if TYPE_CHECKING: | ||
from slither.core.declarations import Contract | ||
|
||
|
||
class EnumContract(Enum, ChildContract): | ||
def is_declared_by(self, contract: "Contract") -> bool: | ||
""" | ||
Check if the element is declared by the contract | ||
:param contract: | ||
:return: | ||
""" | ||
return self.contract == contract |
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,6 @@ | ||
from slither.core.declarations import Enum | ||
from slither.core.declarations.top_level import TopLevel | ||
|
||
|
||
class EnumTopLevel(Enum, TopLevel): | ||
pass |
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,12 @@ | ||
from slither.core.children.child_contract import ChildContract | ||
from slither.core.declarations import Structure | ||
|
||
|
||
class StructureContract(Structure, ChildContract): | ||
def is_declared_by(self, contract): | ||
""" | ||
Check if the element is declared by the contract | ||
:param contract: | ||
:return: | ||
""" | ||
return self.contract == contract |
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,6 @@ | ||
from slither.core.declarations import Structure | ||
from slither.core.declarations.top_level import TopLevel | ||
|
||
|
||
class StructureTopLevel(Structure, TopLevel): | ||
pass |
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,5 @@ | ||
from slither.core.source_mapping.source_mapping import SourceMapping | ||
|
||
|
||
class TopLevel(SourceMapping): | ||
pass |
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
Oops, something went wrong.