public override void VisitCFGExitBlock(ExitBlock x) { VisitCFGBlock(x); // TODO: EdgeToCallers: EnqueueSubscribers(x); }
protected void PingSubscribers(ExitBlock exit) { if (exit != null) { bool wasNotAnalysed = false; if (_state.Routine?.IsReturnAnalysed == false) { wasNotAnalysed = true; _state.Routine.IsReturnAnalysed = true; } // Ping the subscribers either if the return type has changed or // it is the first time the analysis reached the routine exit var rtype = _state.GetReturnType(); if (rtype != exit._lastReturnTypeMask || wasNotAnalysed) { exit._lastReturnTypeMask = rtype; var subscribers = exit.Subscribers; if (subscribers.Count != 0) { lock (subscribers) { foreach (var subscriber in subscribers) { _worklist.PingReturnUpdate(exit, subscriber); } } } } } }
private IEnumerator TeleportToExit(ExitBlock reachedExit, PlayerStateController player) { PlayerManager.Instance.TeleportPlayer(player, reachedExit.transform, false); yield return(TeleportExitCoroutine); this.OnSectionFinished?.Invoke(new SectionTransitionData(reachedExit.TargetSectionID)); this.DisableSection(); }
protected void EnqueueSubscribers(ExitBlock exit) { if (exit != null) { var rtype = _state.GetReturnType(); if (rtype != exit._lastReturnTypeMask) { exit._lastReturnTypeMask = rtype; exit.Subscribers.ForEach(_worklist.Enqueue); } } }
public override void VisitCFGExitBlock(ExitBlock x) { VisitCFGBlock(x); // TODO: EdgeToCallers: var rtype = _state.GetReturnType(); if (rtype != x._lastReturnTypeMask) { x._lastReturnTypeMask = rtype; x.Subscribers.ForEach(_worklist.Enqueue); } }
public void PingReturnUpdate(ExitBlock updatedExit, T callingBlock) { var caller = callingBlock.FlowState?.Routine; if (caller == null || _callGraph.GetCalleeEdges(caller).All(edge => edge.Callee.IsReturnAnalysed)) { Enqueue(callingBlock); } else { _dirtyCallBlocks.TryAdd(callingBlock, null); } }
private Exit GenerateExitFromBlock(ExitBlock eb) { Exit output = new Exit ( eb.PosX, eb.PosY, eb.ExitDirection == Direction.North, eb.ExitDirection == Direction.South, eb.ExitDirection == Direction.East, eb.ExitDirection == Direction.West, eb.ExitToID, 0, 0 ); return(output); }
public bool CreateExitBlock(CreateBlockViewModel model) { var entity = new ExitBlock { MapID = model.MapModel.MapID, OwnerID = _userID, Name = model.CreateBlockModel.Name, Description = model.CreateBlockModel.Description, TypeOfBlock = GetBlockTypeFromString("Exit"), PosX = model.CreateBlockModel.PosX, PosY = model.CreateBlockModel.PosY, ExitDirection = GetExitDirectionFromString(model.CreateBlockModel.ExitDirection), ExitToID = model.CreateBlockModel.ExitToID }; using (var ctx = new ApplicationDbContext()) { ctx.Blocks.Add(entity); return(ctx.SaveChanges() == 1); } }
public void PingReturnUpdate(ExitBlock updatedExit, T callingBlock) { var caller = callingBlock.FlowState?.Routine; // If the update of the analysis is in progress and the caller is not yet analysed (its FlowState is null due to invalidation) or // is not within the currently analysed routines, don't enqueue it if (callingBlock.FlowState == null || (caller != null && _currentRoutinesLastReturnTypes != null && !_currentRoutinesLastReturnTypes.ContainsKey(caller))) { return; } if (caller == null || _callGraph.GetCalleeEdges(caller).All(edge => edge.Callee.IsReturnAnalysed)) { Enqueue(callingBlock); } else { _dirtyCallBlocks.TryAdd(callingBlock, null); } }
private void InvokeSectionFinished(ExitBlock reachedExit, PlayerStateController player) { StartCoroutine(TeleportToExit(reachedExit, player)); }
public void Awake() { GetComponent <SpriteRenderer>().enabled = false; block = GetComponentInChildren <ExitBlock>(); }
// Create the special blocks attached to the method entry / exit. private void CreateEntryAndExitBlocks(Method method, StatementList blocks) { entry_point = new EntryBlock(new MethodHeader(method)); exit_point = new ExitBlock(); normal_exit_point = new NormalExitBlock(); excp_exit_point = new ExcpExitBlock(method); }