private static void RunStatement(ref CaseContext ctx, QueueUpdateStatement stmt) { if (!(ctx.Machine is IUpdatableMachine updatableMachine)) { throw new LogicEngineException("Update queueing is not supported by the machine", stmt); } updatableMachine.QueueUpdate(); }
private void Visit(QueueUpdateStatement stmt) { var callLabel = Generator.DefineLabel("callupdate"); LoadMachine(); Generator.Isinst(typeof(IUpdatableMachine)); Generator.Dup(); Generator.Brtrue(callLabel); Generator.Ldstr($"Called 'update' on a non-updatable machine at {stmt.Location}"); Generator.Newobj(Info.OfConstructor <LogicEngineException>("System.String")); Generator.Throw(); Generator.MarkLabel(callLabel); Generator.Call(Info.OfMethod <IUpdatableMachine>(nameof(IUpdatableMachine.QueueUpdate))); }