diff options
author | Christian <c@ethdev.com> | 2014-10-30 08:20:32 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-30 08:25:42 +0800 |
commit | d038c0751dba11ce8c6d9c3ec2375190ab145b6d (patch) | |
tree | ed9aaf28953071352cd1c8b6094a0bdd159b7e31 | |
parent | bded2ff3726c5626ea59b2bcbdf5fcded25457c7 (diff) | |
download | dexon-solidity-d038c0751dba11ce8c6d9c3ec2375190ab145b6d.tar.gz dexon-solidity-d038c0751dba11ce8c6d9c3ec2375190ab145b6d.tar.zst dexon-solidity-d038c0751dba11ce8c6d9c3ec2375190ab145b6d.zip |
Contract compiler and also add ExpressionStatement to AST.
ExpressionStatement functions as glue between Statements and Expressions.
This way it is possible to detect when the border between statements and
expressions is crossed while walking the AST. Note that ExpressionStatement is
not the only border, almost every statement can contains expressions.
-rw-r--r-- | Assembly.cpp | 2 | ||||
-rw-r--r-- | Assembly.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Assembly.cpp b/Assembly.cpp index 5b10138d..7ad84682 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -54,6 +54,7 @@ unsigned Assembly::bytesRequired() const switch (i.m_type) { case Operation: + case Tag: // 1 byte for the JUMPDEST ret++; break; case PushString: @@ -69,7 +70,6 @@ unsigned Assembly::bytesRequired() const case PushData: case PushSub: ret += 1 + br; - case Tag:; default:; } if (dev::bytesRequired(ret) <= br) @@ -105,7 +105,11 @@ public: void injectStart(AssemblyItem const& _i); std::string out() const { std::stringstream ret; streamRLP(ret); return ret.str(); } + int deposit() const { return m_deposit; } + void adjustDeposit(int _adjustment) { m_deposit += _adjustment; assert(m_deposit >= 0); } + void setDeposit(int _deposit) { m_deposit = _deposit; assert(m_deposit >= 0); } + bytes assemble() const; Assembly& optimise(bool _enable); std::ostream& streamRLP(std::ostream& _out, std::string const& _prefix = "") const; |