mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
LLL: add UNSET to remove a variable
This commit is contained in:
parent
2c6e1888eb
commit
dcfa5f4ea0
@ -259,6 +259,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
|
|||||||
}
|
}
|
||||||
else if (us == "SET")
|
else if (us == "SET")
|
||||||
{
|
{
|
||||||
|
// TODO: move this to be a stack variable (and not a memory variable)
|
||||||
if (_t.size() != 3)
|
if (_t.size() != 3)
|
||||||
error<IncorrectParameterCount>(us);
|
error<IncorrectParameterCount>(us);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
@ -268,6 +269,15 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
|
|||||||
m_asm.append((u256)varAddress(firstAsString(), true));
|
m_asm.append((u256)varAddress(firstAsString(), true));
|
||||||
m_asm.append(Instruction::MSTORE);
|
m_asm.append(Instruction::MSTORE);
|
||||||
}
|
}
|
||||||
|
else if (us == "UNSET")
|
||||||
|
{
|
||||||
|
// TODO: this doesn't actually free up anything, since it is a memory variable (see "SET")
|
||||||
|
if (_t.size() != 2)
|
||||||
|
error<IncorrectParameterCount>();
|
||||||
|
auto it = _s.vars.find(firstAsString());
|
||||||
|
if (it != _s.vars.end())
|
||||||
|
_s.vars.erase(it);
|
||||||
|
}
|
||||||
else if (us == "GET")
|
else if (us == "GET")
|
||||||
{
|
{
|
||||||
if (_t.size() != 2)
|
if (_t.size() != 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user