aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-30 08:20:32 +0800
committerChristian <c@ethdev.com>2014-10-30 08:25:42 +0800
commitd038c0751dba11ce8c6d9c3ec2375190ab145b6d (patch)
treeed9aaf28953071352cd1c8b6094a0bdd159b7e31
parentbded2ff3726c5626ea59b2bcbdf5fcded25457c7 (diff)
downloaddexon-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.cpp2
-rw-r--r--Assembly.h4
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)
diff --git a/Assembly.h b/Assembly.h
index 8ab3062d..38baee0c 100644
--- a/Assembly.h
+++ b/Assembly.h
@@ -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;