@ -5,6 +5,7 @@ from slither.core.expressions import (AssignmentOperationType,
UnaryOperationType , BinaryOperationType )
UnaryOperationType , BinaryOperationType )
from slither . core . solidity_types import ArrayType , ElementaryType
from slither . core . solidity_types import ArrayType , ElementaryType
from slither . core . solidity_types . type import Type
from slither . core . solidity_types . type import Type
from slither . core . variables . local_variable_init_from_tuple import LocalVariableInitFromTuple
from slither . slithir . operations import ( Assignment , Binary , BinaryType , Delete ,
from slither . slithir . operations import ( Assignment , Binary , BinaryType , Delete ,
Index , InitArray , InternalCall , Member ,
Index , InitArray , InternalCall , Member ,
NewArray , NewContract ,
NewArray , NewContract ,
@ -130,6 +131,14 @@ class ExpressionToSlithIR(ExpressionVisitor):
operation . set_expression ( expression )
operation . set_expression ( expression )
self . _result . append ( operation )
self . _result . append ( operation )
set_val ( expression , None )
set_val ( expression , None )
# Tuple with only one element. We need to convert the assignment to a Unpack
# Ex:
# (uint a,,) = g()
elif isinstance ( left , LocalVariableInitFromTuple ) and left . tuple_index :
operation = Unpack ( left , right , left . tuple_index )
operation . set_expression ( expression )
self . _result . append ( operation )
set_val ( expression , None )
else :
else :
# Init of array, like
# Init of array, like
# uint8[2] var = [1,2];
# uint8[2] var = [1,2];