aboutsummaryrefslogtreecommitdiffstats
path: root/liblll/CodeFragment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'liblll/CodeFragment.cpp')
-rw-r--r--liblll/CodeFragment.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index 0f8f2606..d757dcf1 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -35,9 +35,6 @@
using namespace std;
using namespace dev;
using namespace dev::eth;
-namespace qi = boost::spirit::qi;
-namespace px = boost::phoenix;
-namespace sp = boost::spirit;
void CodeFragment::finalise(CompilerState const& _cs)
{
@@ -90,7 +87,7 @@ CodeFragment::CodeFragment(sp::utree const& _t, CompilerState& _s, bool _allowAS
m_asm.append(_s.args.at(s).m_asm);
else if (_s.outers.count(s))
m_asm.append(_s.outers.at(s).m_asm);
- else if (us.find_first_of("1234567890") != 0 && us.find_first_not_of("QWERTYUIOPASDFGHJKLZXCVBNM1234567890_") == string::npos)
+ else if (us.find_first_of("1234567890") != 0 && us.find_first_not_of("QWERTYUIOPASDFGHJKLZXCVBNM1234567890_-") == string::npos)
{
auto it = _s.vars.find(s);
if (it == _s.vars.end())
@@ -477,7 +474,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
requireSize(2);
requireDeposit(0, 1);
- auto begin = m_asm.append();
+ auto begin = m_asm.append(m_asm.newTag());
m_asm.append(code[0].m_asm);
if (us == "WHILE")
m_asm.append(Instruction::ISZERO);
@@ -492,7 +489,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
requireDeposit(1, 1);
m_asm.append(code[0].m_asm, 0);
- auto begin = m_asm.append();
+ auto begin = m_asm.append(m_asm.newTag());
m_asm.append(code[1].m_asm);
m_asm.append(Instruction::ISZERO);
auto end = m_asm.appendJumpI();
@@ -523,7 +520,8 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
requireMaxSize(3);
requireDeposit(1, 1);
- auto subPush = m_asm.appendSubSize(code[0].assembly(ns));
+ auto subPush = m_asm.newSub(make_shared<Assembly>(code[0].assembly(ns)));
+ m_asm.append(m_asm.newPushSubSize(subPush.data()));
m_asm.append(Instruction::DUP1);
if (code.size() == 3)
{
@@ -584,10 +582,14 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
{
m_asm.appendJump(m_asm.errorTag());
}
- else if (us.find_first_of("1234567890") != 0 && us.find_first_not_of("QWERTYUIOPASDFGHJKLZXCVBNM1234567890_") == string::npos)
+ else if (us == "BYTECODESIZE")
+ {
+ m_asm.appendProgramSize();
+ }
+ else if (us.find_first_of("1234567890") != 0 && us.find_first_not_of("QWERTYUIOPASDFGHJKLZXCVBNM1234567890_-") == string::npos)
m_asm.append((u256)varAddress(s));
else
- error<InvalidOperation>();
+ error<InvalidOperation>("Unsupported keyword: '" + us + "'");
}
}