internal void AddResult(Mono.Cecil.Cil.SequencePoint sequencePoint, MutantMetaData mutantMetaData, bool mutantKilled)
 {
     if (sequencePoint == null || sequencePoint.Document == null) return;
     string sourceFileUrl = sequencePoint.Document.Url;
     _readerWriterLock.EnterUpgradeableReadLock();
     try
     {
         if (SourceFiles.All(s => s.Url != sourceFileUrl))
         {
             _readerWriterLock.EnterWriteLock();
             var newSourceFile = new SourceFile();
             newSourceFile.SetUrl(sourceFileUrl);
             SourceFiles.Add(newSourceFile);
             _readerWriterLock.ExitWriteLock();
         }
     }
     finally
     {
         _readerWriterLock.ExitUpgradeableReadLock();
     }
     var sourceFile = SourceFiles.First(s => s.Url == sourceFileUrl);
     sourceFile.AddResult(sequencePoint, mutantMetaData, mutantKilled);
 }
 internal void RegisterMethod(MethodDefinition method)
 {
     if (method.Body.Instructions.All(i => i.SequencePoint == null)) return;
     string sourceFileUrl =
         method.Body.Instructions.First(i => i.SequencePoint != null).SequencePoint.Document.Url;
     _readerWriterLock.EnterUpgradeableReadLock();
     try
     {
         if (SourceFiles.All(s => s.Url != sourceFileUrl))
         {
             _readerWriterLock.EnterWriteLock();
             var newSourceFile = new SourceFile();
             newSourceFile.SetUrl(sourceFileUrl);
             SourceFiles.Add(newSourceFile);
             _readerWriterLock.ExitWriteLock();
         }
     }
     finally
     {
         _readerWriterLock.ExitUpgradeableReadLock();
     }
     var sourceFile = SourceFiles.First(s => s.Url == sourceFileUrl);
     var sequencePoints = method.Body.Instructions
         .Where(i => i.SequencePoint != null && i.ShouldReportSequencePoint())
         .Select(i => i.SequencePoint).Distinct();
     foreach (var point in sequencePoints)
     {
         sourceFile.AddSequencePoint(point);
     }
 }
Exemple #3
0
 internal void MergeFrom(SourceFile sourceFile)
 {
     foreach (var sequencePoint in sourceFile.SequencePoints)
     {
         if (SequencePoints.All(s => s.GetIdentifier() != sequencePoint.GetIdentifier()))
         {
             SequencePoints.Add(sequencePoint);
         }
         else
         {
             SequencePoints.First(s => s.GetIdentifier() == sequencePoint.GetIdentifier()).MergeFrom(
                 sequencePoint);
         }
     }
 }