aboutsummaryrefslogtreecommitdiffstats
path: root/liblll/CodeFragment.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-05 01:50:51 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-11-21 23:37:11 +0800
commitdcfa5f4ea02f785a0354f145a78f039da25ca485 (patch)
tree41628d59e29ccb15fb88f3377d44fa3a3fc47ee8 /liblll/CodeFragment.cpp
parent2c6e1888ebf5d4b7369d3c0a350218583ae1ada5 (diff)
downloaddexon-solidity-dcfa5f4ea02f785a0354f145a78f039da25ca485.tar.gz
dexon-solidity-dcfa5f4ea02f785a0354f145a78f039da25ca485.tar.zst
dexon-solidity-dcfa5f4ea02f785a0354f145a78f039da25ca485.zip
LLL: add UNSET to remove a variable
Diffstat (limited to 'liblll/CodeFragment.cpp')
-rw-r--r--liblll/CodeFragment.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index f37cb8b9..c6ab86f5 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -259,6 +259,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
}
else if (us == "SET")
{
+ // TODO: move this to be a stack variable (and not a memory variable)
if (_t.size() != 3)
error<IncorrectParameterCount>(us);
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(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")
{
if (_t.size() != 2)