diff options
Diffstat (limited to 'liblll/CodeFragment.cpp')
-rw-r--r-- | liblll/CodeFragment.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index 0f7f48ba..9f37bc65 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -515,8 +515,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) requireMaxSize(3); requireDeposit(1, 1); - auto subPush = m_asm.newSub(make_shared<Assembly>(code[0].assembly(ns))); - m_asm.append(m_asm.newPushSubSize(subPush.data())); + auto subPush = m_asm.appendSubroutine(make_shared<Assembly>(code[0].assembly(ns))); m_asm.append(Instruction::DUP1); if (code.size() == 3) { @@ -571,7 +570,9 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) { for (auto const& i: code) m_asm.append(i.m_asm); - m_asm.popTo(1); + // Leave only the last item on stack. + while (m_asm.deposit() > 1) + m_asm.append(Instruction::POP); } else if (us == "BYTECODESIZE") { |