Skip to content

Commit 9741bf1

Browse files
committed
CppCodeBuilder: Process instructions
1 parent 7a77ef9 commit 9741bf1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/engine/internal/codegen/cpp/cppcodebuilder.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ CppCodeBuilder::CppCodeBuilder(CppCompilerContext *ctx, BlockPrototype *procedur
1818

1919
std::shared_ptr<ExecutableCode> CppCodeBuilder::build()
2020
{
21+
// Build recorded instructions
22+
CppInstruction *ins = m_instructions.first();
23+
24+
while (ins)
25+
ins = m_instructionBuilder.process(ins);
26+
2127
return std::make_shared<CppExecutableCode>(m_ctx);
2228
}
2329

‎src/engine/internal/codegen/cpp/cppcodebuilder.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
#pragma once
44

55
#include "../icodebuilder.h"
6+
#include "cppinstructionlist.h"
7+
#include "instructions/instructionbuilder.h"
68

79
namespace libscratchcpp
810
{
911

1012
class CppCompilerContext;
1113
class CppValue;
12-
class CppInstruction;
1314

1415
class CppCodeBuilder : public ICodeBuilder
1516
{
@@ -114,6 +115,8 @@ class CppCodeBuilder : public ICodeBuilder
114115

115116
std::vector<std::shared_ptr<CppValue>> m_values;
116117
std::vector<std::shared_ptr<CompilerLocalVariable>> m_localVars;
118+
CppInstructionList m_instructions;
119+
cppins::InstructionBuilder m_instructionBuilder;
117120
};
118121

119122
} // namespace libscratchcpp

0 commit comments

Comments
 (0)