From 3174a5e0c6072004159326f000c0e1dfe6703b00 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 1 Jul 2014 00:16:01 +0200 Subject: Fixed problem with alloc. --- CodeFragment.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'CodeFragment.h') diff --git a/CodeFragment.h b/CodeFragment.h index b9d44c03..58e40912 100644 --- a/CodeFragment.h +++ b/CodeFragment.h @@ -43,18 +43,21 @@ public: static CodeFragment compile(std::string const& _src, CompilerState& _s); /// Consolidates data and compiles code. - bytes code() const { return m_asm.assemble(); } + bytes code(CompilerState const& _cs); /// Consolidates data and compiles code. - std::string assembly() const { return m_asm.out(); } + std::string assembly(CompilerState const& _cs) { finalise(_cs); return m_asm.out(); } /// Optimise the code. Best do this just before calling code() or assembly(). void optimise() { m_asm.optimise(); } private: + void finalise(CompilerState const& _cs); + template void error() const { throw T(); } void constructOperation(sp::utree const& _t, CompilerState& _s); + bool m_finalised = false; Assembly m_asm; }; -- cgit