@@ -182,6 +182,62 @@ CompilerValue *Compiler::addInput(const std::string &name)
182182 return addInput (impl->block ->inputAt (impl->block ->findInput (name)).get ());
183183}
184184
185+ /* ! Compiles the given input and adds it to the compiled code. */
186+ CompilerValue *Compiler::addInput (Input *input)
187+ {
188+ if (!input)
189+ return addConstValue (Value ());
190+
191+ switch (input->type ()) {
192+ case Input::Type::Shadow:
193+ case Input::Type::NoShadow: {
194+ if (input->pointsToDropdownMenu ())
195+ return addConstValue (input->selectedMenuItem ());
196+ else {
197+ CompilerValue *ret = nullptr ;
198+ auto previousBlock = impl->block ;
199+ impl->block = input->valueBlock ();
200+
201+ if (impl->block ) {
202+ if (impl->block ->compileFunction ())
203+ ret = impl->block ->compile (this );
204+ else {
205+ std::cout << " warning: unsupported reporter block: " << impl->block ->opcode () << std::endl;
206+ impl->unsupportedBlocks .insert (impl->block ->opcode ());
207+ ret = addConstValue (Value ());
208+ }
209+ } else
210+ ret = addConstValue (input->primaryValue ()->value ());
211+
212+ impl->block = previousBlock;
213+ return ret;
214+ }
215+ }
216+
217+ case Input::Type::ObscuredShadow: {
218+ CompilerValue *ret = nullptr ;
219+ auto previousBlock = impl->block ;
220+ impl->block = input->valueBlock ();
221+
222+ if (impl->block ) {
223+ if (impl->block ->compileFunction ())
224+ ret = impl->block ->compile (this );
225+ else {
226+ std::cout << " warning: unsupported reporter block: " << impl->block ->opcode () << std::endl;
227+ impl->unsupportedBlocks .insert (impl->block ->opcode ());
228+ ret = addConstValue (Value ());
229+ }
230+ } else
231+ ret = input->primaryValue ()->compile (this );
232+
233+ impl->block = previousBlock;
234+ return ret;
235+ }
236+ }
237+
238+ return nullptr ;
239+ }
240+
185241/* ! Creates an add instruction. */
186242CompilerValue *Compiler::createAdd (CompilerValue *operand1, CompilerValue *operand2)
187243{
@@ -583,58 +639,3 @@ std::shared_ptr<CompilerContext> Compiler::createContext(IEngine *engine, Target
583639 CompilerPrivate::initBuilderFactory ();
584640 return CompilerPrivate::builderFactory->createCtx (engine, target);
585641}
586-
587- CompilerValue *Compiler::addInput (Input *input)
588- {
589- if (!input)
590- return addConstValue (Value ());
591-
592- switch (input->type ()) {
593- case Input::Type::Shadow:
594- case Input::Type::NoShadow: {
595- if (input->pointsToDropdownMenu ())
596- return addConstValue (input->selectedMenuItem ());
597- else {
598- CompilerValue *ret = nullptr ;
599- auto previousBlock = impl->block ;
600- impl->block = input->valueBlock ();
601-
602- if (impl->block ) {
603- if (impl->block ->compileFunction ())
604- ret = impl->block ->compile (this );
605- else {
606- std::cout << " warning: unsupported reporter block: " << impl->block ->opcode () << std::endl;
607- impl->unsupportedBlocks .insert (impl->block ->opcode ());
608- ret = addConstValue (Value ());
609- }
610- } else
611- ret = addConstValue (input->primaryValue ()->value ());
612-
613- impl->block = previousBlock;
614- return ret;
615- }
616- }
617-
618- case Input::Type::ObscuredShadow: {
619- CompilerValue *ret = nullptr ;
620- auto previousBlock = impl->block ;
621- impl->block = input->valueBlock ();
622-
623- if (impl->block ) {
624- if (impl->block ->compileFunction ())
625- ret = impl->block ->compile (this );
626- else {
627- std::cout << " warning: unsupported reporter block: " << impl->block ->opcode () << std::endl;
628- impl->unsupportedBlocks .insert (impl->block ->opcode ());
629- ret = addConstValue (Value ());
630- }
631- } else
632- ret = input->primaryValue ()->compile (this );
633-
634- impl->block = previousBlock;
635- return ret;
636- }
637- }
638-
639- return nullptr ;
640- }
0 commit comments