do not considered local variable that are reference types as `in_storage`

pull/2099/head
alpharush 1 year ago
parent 47e274c907
commit 66def310e7
  1. 4
      slither/slithir/convert.py
  2. 4
      slither/vyper_parsing/variables/local_variable.py

@ -576,7 +576,9 @@ def propagate_types(ir: Operation, node: "Node"): # pylint: disable=too-many-lo
if isinstance(t, ArrayType) or ( if isinstance(t, ArrayType) or (
isinstance(t, ElementaryType) and t.type == "bytes" isinstance(t, ElementaryType) and t.type == "bytes"
): ):
if ir.function_name == "push" and len(ir.arguments) <= 1: # Solidity uses push
# Vyper uses append
if ir.function_name in ["push", "append"] and len(ir.arguments) <= 1:
return convert_to_push(ir, node) return convert_to_push(ir, node)
if ir.function_name == "pop" and len(ir.arguments) == 0: if ir.function_name == "pop" and len(ir.arguments) == 0:
return convert_to_pop(ir, node) return convert_to_pop(ir, node)

@ -25,7 +25,9 @@ class LocalVariableVyper:
assert isinstance(self._elem_to_parse, (Name, Subscript, Call, Tuple)) assert isinstance(self._elem_to_parse, (Name, Subscript, Call, Tuple))
self._variable.set_location("default") # Vyper does not have data locations or storage pointers.
# If this was left as default, reference types would be considered storage by `LocalVariable.is_storage`
self._variable.set_location("memory")
@property @property
def underlying_variable(self) -> LocalVariable: def underlying_variable(self) -> LocalVariable:

Loading…
Cancel
Save