mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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:
parent
bded2ff372
commit
d038c0751d
@ -54,6 +54,7 @@ unsigned Assembly::bytesRequired() const
|
|||||||
switch (i.m_type)
|
switch (i.m_type)
|
||||||
{
|
{
|
||||||
case Operation:
|
case Operation:
|
||||||
|
case Tag: // 1 byte for the JUMPDEST
|
||||||
ret++;
|
ret++;
|
||||||
break;
|
break;
|
||||||
case PushString:
|
case PushString:
|
||||||
@ -69,7 +70,6 @@ unsigned Assembly::bytesRequired() const
|
|||||||
case PushData:
|
case PushData:
|
||||||
case PushSub:
|
case PushSub:
|
||||||
ret += 1 + br;
|
ret += 1 + br;
|
||||||
case Tag:;
|
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
if (dev::bytesRequired(ret) <= br)
|
if (dev::bytesRequired(ret) <= br)
|
||||||
|
@ -105,7 +105,11 @@ public:
|
|||||||
void injectStart(AssemblyItem const& _i);
|
void injectStart(AssemblyItem const& _i);
|
||||||
|
|
||||||
std::string out() const { std::stringstream ret; streamRLP(ret); return ret.str(); }
|
std::string out() const { std::stringstream ret; streamRLP(ret); return ret.str(); }
|
||||||
|
|
||||||
int deposit() const { return m_deposit; }
|
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;
|
bytes assemble() const;
|
||||||
Assembly& optimise(bool _enable);
|
Assembly& optimise(bool _enable);
|
||||||
std::ostream& streamRLP(std::ostream& _out, std::string const& _prefix = "") const;
|
std::ostream& streamRLP(std::ostream& _out, std::string const& _prefix = "") const;
|
||||||
|
Loading…
Reference in New Issue
Block a user