hardhat-vscode icon indicating copy to clipboard operation
hardhat-vscode copied to clipboard

Assembly references to storage variables are not included

Open fvictorio opened this issue 1 year ago • 0 comments
trafficstars

"Go to references" works well with assembly for local variables. For example, using it with value here correctly includes the assembly line:

uint value;

assembly {
  value = 1
}

But if you do the same thing with a storage variable, then it doesn't work:

contract Foo {
  uint public x;

  function inc() public {
    x++;
  }
  
  function set(uint _x) public {
    x = _x;
  }

  function setWithAssembly(uint _x) public {
    assembly {
      sstore(x.slot, _x)
    }
  }
}

Here, the references list for x includes x++ and x = _x, but it doesn't include sstore(x.slot, _x).

fvictorio avatar Sep 20 '24 09:09 fvictorio