diff options
Diffstat (limited to 'CodeFragment.h')
-rw-r--r-- | CodeFragment.h | 7 |
1 files changed, 5 insertions, 2 deletions
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 <class T> void error() const { throw T(); } void constructOperation(sp::utree const& _t, CompilerState& _s); + bool m_finalised = false; Assembly m_asm; }; |