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.
This commit is contained in:
Christian 2014-10-30 01:20:32 +01:00
parent bded2ff372
commit d038c0751d
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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;