File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ class LIBSCRATCHCPP_EXPORT Compiler
148148
149149 void createYield ();
150150 void createStop ();
151+ void createStopWithoutSync ();
151152
152153 void createProcedureCall (BlockPrototype *prototype, const Compiler::Args &args);
153154
Original file line number Diff line number Diff line change @@ -705,6 +705,16 @@ void Compiler::createStop()
705705 impl->builder ->createStop ();
706706}
707707
708+ /* !
709+ * Creates a stop script without synchronization instruction.\n
710+ * Use this if synchronization is not possible at the stop point.
711+ * \note Only use this when everything is synchronized, e. g. after a function call.
712+ */
713+ void Compiler::createStopWithoutSync ()
714+ {
715+ impl->builder ->createStopWithoutSync ();
716+ }
717+
708718/* ! Creates a call to the procedure with the given prototype. */
709719void Compiler::createProcedureCall (BlockPrototype *prototype, const libscratchcpp::Compiler::Args &args)
710720{
Original file line number Diff line number Diff line change @@ -1673,6 +1673,20 @@ TEST_F(CompilerTest, CreateStop)
16731673 compile (m_compiler.get (), block.get ());
16741674}
16751675
1676+ TEST_F (CompilerTest, CreateStopWithoutSync)
1677+ {
1678+
1679+ auto block = std::make_shared<Block>(" " , " " );
1680+
1681+ block->setCompileFunction ([](Compiler *compiler) -> CompilerValue * {
1682+ EXPECT_CALL (*m_builder, createStopWithoutSync ());
1683+ compiler->createStopWithoutSync ();
1684+ return nullptr ;
1685+ });
1686+
1687+ compile (m_compiler.get (), block.get ());
1688+ }
1689+
16761690TEST_F (CompilerTest, CreateProcedureCall)
16771691{
16781692
You can’t perform that action at this time.
0 commit comments