コード例 #1
0
 def __init__(self, result, left_variable, right_variable, operation_type):
     assert is_valid_rvalue(left_variable) or isinstance(
         left_variable, Function)
     assert is_valid_rvalue(right_variable) or isinstance(
         right_variable, Function)
     assert is_valid_lvalue(result)
     assert isinstance(operation_type, BinaryType)
     super().__init__()
     self._variables = [left_variable, right_variable]
     self._type = operation_type
     self._lvalue = result
     if BinaryType.return_bool(operation_type):
         result.set_type(ElementaryType("bool"))
     else:
         result.set_type(left_variable.type)
コード例 #2
0
 def __init__(self, value, lvalue):
     super().__init__()
     assert is_valid_rvalue(value)
     assert is_valid_lvalue(lvalue)
     self._value = value
     self._lvalue = lvalue
     lvalue.set_type(ElementaryType("uint256"))
コード例 #3
0
 def __init__(self, result, variable, operation_type):
     assert is_valid_rvalue(variable)
     assert is_valid_lvalue(result)
     super().__init__()
     self._variable = variable
     self._type = operation_type
     self._lvalue = result
コード例 #4
0
 def _valid_value(self, value):
     if isinstance(value, list):
         assert all(self._valid_value(v) for v in value)
     else:
         assert is_valid_rvalue(value) or isinstance(
             value, (TupleVariable, Function))
     return True
コード例 #5
0
    def __init__(self, result, variable, variable_type):
        super().__init__()
        assert is_valid_rvalue(variable) or isinstance(variable, Contract)
        assert is_valid_lvalue(result)
        assert isinstance(variable_type, Type)

        self._variable = variable
        self._type = variable_type
        self._lvalue = result
コード例 #6
0
 def __init__(self, left_variable, right_variable, variable_return_type):
     assert is_valid_lvalue(left_variable)
     assert is_valid_rvalue(right_variable) or isinstance(
         right_variable, (Function, TupleVariable))
     super().__init__()
     self._variables = [left_variable, right_variable]
     self._lvalue = left_variable
     self._rvalue = right_variable
     self._variable_return_type = variable_return_type
コード例 #7
0
 def __init__(self, result, left_variable, right_variable, index_type):
     super().__init__()
     assert is_valid_lvalue(
         left_variable) or left_variable == SolidityVariableComposed(
             "msg.data")
     assert is_valid_rvalue(right_variable)
     assert isinstance(result, ReferenceVariable)
     self._variables = [left_variable, right_variable]
     self._type = index_type
     self._lvalue = result
コード例 #8
0
 def __init__(self, values):
     # Note: Can return None
     # ex: return call()
     # where call() dont return
     if not isinstance(values, list):
         assert (is_valid_rvalue(values)
                 or isinstance(values,
                               (TupleVariable, Function)) or values is None)
         if values is None:
             values = []
         else:
             values = [values]
     else:
         # Remove None
         # Prior Solidity 0.5
         # return (0,)
         # was valid for returns(uint)
         values = [v for v in values if not v is None]
         self._valid_value(values)
     super().__init__()
     self._values = values
コード例 #9
0
 def __init__(self, variable_left, variable_right, result):
     # Function can happen for something like
     # library FunctionExtensions {
     #     function h(function() internal _t, uint8) internal {  }
     # }
     # contract FunctionMembers {
     #     using FunctionExtensions for function();
     #
     #     function f() public {
     #         f.h(1);
     #     }
     # }
     assert is_valid_rvalue(variable_left) or isinstance(
         variable_left, (Contract, Enum, Function))
     assert isinstance(variable_right, Constant)
     assert isinstance(result, ReferenceVariable)
     super().__init__()
     self._variable_left = variable_left
     self._variable_right = variable_right
     self._lvalue = result
     self._gas = None
     self._value = None
コード例 #10
0
 def check(elem):
     if isinstance(elem, (list, )):
         return reduce(elem)
     return is_valid_rvalue(elem)
コード例 #11
0
 def __init__(self, value):
     assert is_valid_rvalue(value)
     super().__init__()
     self._value = value
コード例 #12
0
 def __init__(self, array, value):
     super().__init__()
     assert is_valid_rvalue(value) or isinstance(value, Function)
     assert is_valid_lvalue(array)
     self._value = value
     self._lvalue = array