protected void EnqueueNewNode(ProgramPoint programPoint, ProgramState programState) { if (programState == null) { return; } var pos = programPoint; if (this.programPoints.ContainsKey(programPoint)) { pos = this.programPoints[programPoint]; } else { this.programPoints[pos] = pos; } if (programState.GetVisitedCount(pos) >= MaxProgramPointExecutionCount) { OnProgramPointVisitCountExceedLimit(pos, programState); return; } var newNode = new ExplodedGraphNode(pos, programState.AddVisit(pos)); if (this.nodesAlreadyInGraph.Add(newNode)) { this.workList.Enqueue(newNode); } }
protected void EnqueueNewNode(ProgramPoint programPoint, ProgramState programState) { if (programState == null) { return; } var pos = programPoint; if (this.programPoints.ContainsKey(programPoint)) { pos = this.programPoints[programPoint]; } else { this.programPoints[pos] = pos; } ExplodedGraphNode newNode = null; if (programState.GetVisitedCount(pos) >= MaxProgramPointExecutionCount) { OnProgramPointVisitCountExceedLimit(pos, programState); // reached the max number of visit by program point, in the case of ForEach blocks, we take the foreach loop false branch with current program state, // if it is not a foreach loop, newNode will be null and we will stop exploring the path if (GetForEachExitBlock(programPoint.Block) is Block forEachExitBlock) { newNode = new ExplodedGraphNode(new ProgramPoint(forEachExitBlock), programState); } } else { newNode = new ExplodedGraphNode(pos, programState.AddVisit(pos)); } if (newNode != null && this.nodesAlreadyInGraph.Add(newNode)) { this.workList.Enqueue(newNode); } }