Ejemplo n.º 1
0
 public bool Equals(BoundaryProblem other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Kind, Kind) && Equals(other.TargetName, TargetName) && Equals(other.Message, Message) && Equals(other.FlippedLocation, FlippedLocation) && Equals(other.FlippedCondition, FlippedCondition));
 }
Ejemplo n.º 2
0
 public bool Equals(BoundaryProblem other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Kind, Kind) && Equals(other.TargetName, TargetName) && Equals(other.Message, Message) && Equals(other.FlippedLocation, FlippedLocation) && Equals(other.FlippedCondition, FlippedCondition);
 }
Ejemplo n.º 3
0
        void Log_ExplorationBoundaryHandler(ExplorationBoundaryEventArgs e)
        {
            var database = Host.GetService<ProblemTrackDatabase>();
            ProblemEventArgs successfulFlippedPathCondition = database.CurrentSuccessfulFlippedPathCondition;
            StringBuilder log = database.SimpleLog;

            SequencePoint sp;
            if (successfulFlippedPathCondition == null)
            {
                return;
            }
            CodeLocation location = successfulFlippedPathCondition.FlippedLocation;
            Host.Services.SymbolManager.TryGetSequencePoint(location.Method, location.Offset, out sp);
            StringBuilder sb = new StringBuilder("/////////////////////////////////// \n");
            log.AppendLine("exception: " + e.Kind + " e.TargetName: " + e.TargetName + " message: " + e);
            sb.AppendLine("flipped location: " + sp.Document + " line: " + sp.Line);
            var branchInfo = new BranchInfo("",0,0,0,"",0);
            try
            {
                branchInfo = new BranchInfo(sp.Document, sp.Line, sp.Column, sp.EndColumn, location.Method.FullName, location.Offset);
            }
            catch (Exception)
            {

            }

            var flippedCondition = successfulFlippedPathCondition.Suffix;
            var stringWriter = new StringWriter();
            var bodyWriter = this.Host.Services.LanguageManager.DefaultLanguage.CreateBodyWriter(stringWriter,
                                                                                                 VisibilityContext.
                                                                                                     Private);
            var emitter = new TermEmitter(successfulFlippedPathCondition.TermManager, new NameCreator());
            if (emitter.TryEvaluate(Indexable.One(flippedCondition), 1000, bodyWriter))
            {
                bodyWriter.Return(SystemTypes.Bool);
            }

            stringWriter.WriteLine();
            stringWriter.WriteLine("Feasible prefixes:");
            if (successfulFlippedPathCondition.FeasiblePrefix != null && successfulFlippedPathCondition.FeasiblePrefix.Length > 0)
            {
                var bodyWriter2 = this.Host.Services.LanguageManager.DefaultLanguage.CreateBodyWriter(stringWriter,
                                                                                                VisibilityContext.
                                                                                                    Private);
                foreach (Term prefix in successfulFlippedPathCondition.FeasiblePrefix)
                {
                    if (emitter.TryEvaluate(Indexable.One(prefix), 1000, bodyWriter2))
                    {
                        bodyWriter2.Return(SystemTypes.Bool);
                    }
                }
            }
            else
            {
                stringWriter.WriteLine("No feasible prefixes.");
            }

            this.Host.Log.Dump("My Category", "condition", stringWriter.ToString());
            sb.AppendLine(stringWriter.ToString());

            sb.AppendLine("///////////////////////////////////");
            var issue = new BoundaryProblem(e.Kind.ToString(), e.TargetName.ToString(), e.Message, branchInfo, stringWriter.ToString());
            Host.GetService<ProblemTrackDatabase>().BoundaryIssues.Add(issue);
            log.AppendLine(sb.ToString());
            //            e.
        }
Ejemplo n.º 4
0
        void Log_ExplorationBoundaryHandler(ExplorationBoundaryEventArgs e)
        {
            var database = Host.GetService <ProblemTrackDatabase>();
            ProblemEventArgs successfulFlippedPathCondition = database.CurrentSuccessfulFlippedPathCondition;
            StringBuilder    log = database.SimpleLog;


            SequencePoint sp;

            if (successfulFlippedPathCondition == null)
            {
                return;
            }
            CodeLocation location = successfulFlippedPathCondition.FlippedLocation;

            Host.Services.SymbolManager.TryGetSequencePoint(location.Method, location.Offset, out sp);
            StringBuilder sb = new StringBuilder("/////////////////////////////////// \n");

            log.AppendLine("exception: " + e.Kind + " e.TargetName: " + e.TargetName + " message: " + e);
            sb.AppendLine("flipped location: " + sp.Document + " line: " + sp.Line);
            var branchInfo = new BranchInfo("", 0, 0, 0, "", 0);

            try
            {
                branchInfo = new BranchInfo(sp.Document, sp.Line, sp.Column, sp.EndColumn, location.Method.FullName, location.Offset);
            }
            catch (Exception)
            {
            }


            var flippedCondition = successfulFlippedPathCondition.Suffix;
            var stringWriter     = new StringWriter();
            var bodyWriter       = this.Host.Services.LanguageManager.DefaultLanguage.CreateBodyWriter(stringWriter,
                                                                                                       VisibilityContext.
                                                                                                       Private);
            var emitter = new TermEmitter(successfulFlippedPathCondition.TermManager, new NameCreator());

            if (emitter.TryEvaluate(Indexable.One(flippedCondition), 1000, bodyWriter))
            {
                bodyWriter.Return(SystemTypes.Bool);
            }

            stringWriter.WriteLine();
            stringWriter.WriteLine("Feasible prefixes:");
            if (successfulFlippedPathCondition.FeasiblePrefix != null && successfulFlippedPathCondition.FeasiblePrefix.Length > 0)
            {
                var bodyWriter2 = this.Host.Services.LanguageManager.DefaultLanguage.CreateBodyWriter(stringWriter,
                                                                                                      VisibilityContext.
                                                                                                      Private);
                foreach (Term prefix in successfulFlippedPathCondition.FeasiblePrefix)
                {
                    if (emitter.TryEvaluate(Indexable.One(prefix), 1000, bodyWriter2))
                    {
                        bodyWriter2.Return(SystemTypes.Bool);
                    }
                }
            }
            else
            {
                stringWriter.WriteLine("No feasible prefixes.");
            }

            this.Host.Log.Dump("My Category", "condition", stringWriter.ToString());
            sb.AppendLine(stringWriter.ToString());

            sb.AppendLine("///////////////////////////////////");
            var issue = new BoundaryProblem(e.Kind.ToString(), e.TargetName.ToString(), e.Message, branchInfo, stringWriter.ToString());

            Host.GetService <ProblemTrackDatabase>().BoundaryIssues.Add(issue);
            log.AppendLine(sb.ToString());
//            e.
        }