@@ -77,21 +77,24 @@ void Engine::compile()
7777 for (auto block : blocks) {
7878 if (block->topLevel ()) {
7979 auto section = blockSection (block->opcode ());
80- Compiler compiler (this , block);
81- compiler.setConstInputValues (constInputValues);
82- compiler.setVariables (variables);
83- compiler.setLists (lists);
84- compiler.compile ();
85- variables = compiler.variables ();
86- lists = compiler.lists ();
87- constInputValues = compiler.constInputValues ();
88- auto vm = std::make_shared<VirtualMachine>();
89- vm->setFunctions (m_functions);
90- vm->setConstValues (compiler.constValues ());
91- vm->setVariables (compiler.variablePtrs ());
92- vm->setLists (lists);
93- vm->setBytecode (compiler.bytecode ());
94- m_scripts[block] = vm;
80+ if (section) {
81+ Compiler compiler (this , block);
82+ compiler.setConstInputValues (constInputValues);
83+ compiler.setVariables (variables);
84+ compiler.setLists (lists);
85+ compiler.compile ();
86+ variables = compiler.variables ();
87+ lists = compiler.lists ();
88+ constInputValues = compiler.constInputValues ();
89+ auto vm = std::make_shared<VirtualMachine>();
90+ vm->setFunctions (m_functions);
91+ vm->setConstValues (compiler.constValues ());
92+ vm->setVariables (compiler.variablePtrs ());
93+ vm->setLists (lists);
94+ vm->setBytecode (compiler.bytecode ());
95+ m_scripts[block] = vm;
96+ } else
97+ std::cout << " warning: unsupported top level block: " << block->opcode () << std::endl;
9598 }
9699 }
97100 }
0 commit comments