Skip to content

Commit 87f2e28

Browse files
committed
move VariableLocation to variable.py
1 parent bfa789f commit 87f2e28

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

slither/core/variables/local_variable.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
import enum
21
from typing import TYPE_CHECKING, Optional
32

43
from slither.core.declarations.structure import Structure
54
from slither.core.solidity_types.elementary_type import ElementaryType
65
from slither.core.solidity_types.mapping_type import MappingType
76
from slither.core.solidity_types.user_defined_type import UserDefinedType
8-
from slither.core.variables.variable import Variable
7+
from slither.core.variables.variable import Variable, VariableLocation
98

109
if TYPE_CHECKING: # type: ignore
1110
from slither.core.declarations import Function
1211

1312

14-
class VariableLocation(enum.Enum):
15-
MEMORY = "memory"
16-
CALLDATA = "calldata"
17-
STORAGE = "storage"
18-
REFERENCE_TO_STORAGE = "reference_to_storage"
19-
TRANSIENT = "transient"
20-
21-
2213
class LocalVariable(Variable):
2314
def __init__(self) -> None:
2415
super().__init__()

slither/core/variables/state_variable.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from typing import TYPE_CHECKING, Optional
22

33
from slither.core.declarations.contract_level import ContractLevel
4-
from slither.core.variables.local_variable import VariableLocation
5-
from slither.core.variables.variable import Variable
4+
from slither.core.variables.variable import Variable, VariableLocation
65

76
if TYPE_CHECKING:
87
from slither.core.cfg.node import Node

slither/core/variables/variable.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Variable module
33
"""
44
from typing import Optional, TYPE_CHECKING, List, Union, Tuple
5+
from enum import Enum
56

67
from slither.core.source_mapping.source_mapping import SourceMapping
78
from slither.core.solidity_types.type import Type
@@ -11,6 +12,16 @@
1112
from slither.core.expressions.expression import Expression
1213
from slither.core.declarations import Function
1314

15+
16+
class VariableLocation(Enum):
17+
DEFAULT = "default"
18+
MEMORY = "memory"
19+
CALLDATA = "calldata"
20+
STORAGE = "storage"
21+
REFERENCE_TO_STORAGE = "reference_to_storage"
22+
TRANSIENT = "transient"
23+
24+
1425
# pylint: disable=too-many-instance-attributes
1526
class Variable(SourceMapping):
1627
def __init__(self) -> None:

tests/unit/slithir/test_ssa_generation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
from slither.core.cfg.node import Node, NodeType
1313
from slither.core.declarations import Contract, Function
1414
from slither.core.solidity_types import ArrayType, ElementaryType
15-
from slither.core.variables.local_variable import LocalVariable, VariableLocation
15+
from slither.core.variables.local_variable import LocalVariable
1616
from slither.core.variables.state_variable import StateVariable
17+
from slither.core.variables.variable import VariableLocation
1718
from slither.slithir.operations import (
1819
Assignment,
1920
Binary,

0 commit comments

Comments
 (0)