Exemplo n.º 1
0
    def __init__(self, var: LocalVariable, root: YulScope, ast: Dict):
        assert ast["nodeType"] == "YulTypedName"

        self._variable = var
        self._root = root

        # start initializing the underlying variable
        var.set_function(root.function)
        var.set_offset(ast["src"], root.slither)

        var.name = _name_to_yul_name(ast["name"], root.id)
        var.set_type(ElementaryType("uint256"))
        var.set_location("memory")
Exemplo n.º 2
0
    def __init__(self, var: LocalVariable, root: YulScope, ast: Dict):
        assert (ast['nodeType'] == 'YulTypedName')

        self._variable = var
        self._root = root

        # start initializing the underlying variable
        var.set_function(root.function)
        var.set_offset(ast["src"], root.slither)

        var.name = ast['name']
        var.set_type(ElementaryType('uint256'))
        var.set_location('memory')
Exemplo n.º 3
0
def convert_yul_typed_name(root: YulScope, parent: YulNode,
                           ast: Dict) -> YulNode:
    local_var = LocalVariable()

    var = YulLocalVariable(local_var, root, ast)
    root.add_yul_local_variable(var)

    node = root.new_node(NodeType.VARIABLE, ast["src"])
    node.underlying_node.add_variable_declaration(local_var)
    link_underlying_nodes(parent, node)

    return node
    def _add_param(self, param: Dict) -> LocalVariableSolc:

        local_var = LocalVariable()
        local_var.set_offset(param["src"],
                             self._slither_parser.compilation_unit)

        local_var_parser = LocalVariableSolc(local_var, param)

        if isinstance(self._custom_error, CustomErrorTopLevel):
            local_var_parser.analyze(self)
        else:
            assert isinstance(self._custom_error, CustomErrorContract)
            local_var_parser.analyze(self)

        # see https://solidity.readthedocs.io/en/v0.4.24/types.html?highlight=storage%20location#data-location
        if local_var.location == "default":
            local_var.set_location("memory")

        return local_var_parser