private void OnEvalCompleted(object sender, EvaluationCompletedEventArgs e)
        {
            MemoryInstrumentationSink sink = (MemoryInstrumentationSink)e.Submission.Sink;

            var methods = sink.GetRootCalls();

            if (methods == null || methods.Count == 0)
            {
                return;
            }

            RootCall = methods.Values.First();
            Status   = null;
        }
        private async void ProcessInput()
        {
            var source = Interlocked.Exchange(ref this.submission, null);

            if (source != null)
            {
                source.Cancel();
            }

            if (String.IsNullOrEmpty(input) || String.IsNullOrEmpty(TestCode))
            {
                return;
            }

            int id = Interlocked.Increment(ref this.submissionId);

            Either <string, Error> result = await Instantly.Instrument(input, id);

            string instrumented = result.Fold(i => i, e => null);

            if (instrumented == null)
            {
                return;
            }

            Project project = new Project();

            project.Sources.Add(Either <FileInfo, string> .B(instrumented));

            Submission s    = null;
            var        sink = new MemoryInstrumentationSink(() => s.IsCanceled);

            s = new Submission(id, project, sink, TestCode);

            if (DebugTree)
            {
                Debug = instrumented;
            }

            this.evaluator.PushSubmission(s);
        }
Exemple #3
0
        private async Task Execute(ITextSnapshot snapshot, CancellationToken cancelToken)
        {
            this.statusbar.SetText("Evaluating...");

            int id = Interlocked.Increment(ref submissionId);

            string original = snapshot.GetText();
            bool   error    = false;
            var    result   = await Instantly.Instrument(original, id);

            string text = result.Fold(
                s => s,
                e =>
            {
                error = true;
                return(String.Format("L{0}: {1}", e.Region.BeginLine, e.Message));
            });

            if (cancelToken.IsCancellationRequested)
            {
                this.statusbar.SetText("Evaluation canceled.");
                return;
            }

            if (error)
            {
                this.statusbar.SetText(text);
                return;
            }

            IProject project = this.dte.GetProject(this.document, text);

            Submission submission = null;
            var        sink       = new MemoryInstrumentationSink(() => submission.IsCanceled);

            submission     = new Submission(id, project, sink, this.context.TestCode);
            submission.Tag = new Tuple <ITextSnapshot, string> (snapshot, original);

            this.evaluator.PushSubmission(submission);
        }
Exemple #4
0
		private async Task Execute (ITextSnapshot snapshot, CancellationToken cancelToken)
		{
			this.statusbar.SetText ("Evaluating...");

			int id = Interlocked.Increment (ref submissionId);

			string original = snapshot.GetText();
			bool error = false;
			var result = await Instantly.Instrument (original, id);
			string text = result.Fold (
				s => s,
				e =>
				{
					error = true;
					return String.Format ("L{0}: {1}", e.Region.BeginLine, e.Message);
				});

			if (cancelToken.IsCancellationRequested)
			{
				this.statusbar.SetText ("Evaluation canceled.");
				return;
			}

			if (error)
			{
				this.statusbar.SetText (text);
				return;
			}

			IProject project = this.dte.GetProject (this.document, text);

			Submission submission = null;
			var sink = new MemoryInstrumentationSink (() => submission.IsCanceled);
			submission = new Submission (id, project, sink, this.context.TestCode);
			submission.Tag = new Tuple<ITextSnapshot, string> (snapshot, original);

			this.evaluator.PushSubmission (submission);
		}
Exemple #5
0
		private async void ProcessInput()
		{
			var source = Interlocked.Exchange (ref this.submission, null);

			if (source != null)
				source.Cancel();

			if (String.IsNullOrEmpty (input) || String.IsNullOrEmpty (TestCode))
				return;

			int id = Interlocked.Increment (ref this.submissionId);

			Either<string, Error> result = await Instantly.Instrument (input, id);
			string instrumented = result.Fold (i => i, e => null);
			if (instrumented == null)
				return;

			Project project = new Project();
			project.Sources.Add (Either<FileInfo, string>.B (instrumented));

			Submission s = null;
			var sink = new MemoryInstrumentationSink (() => s.IsCanceled);
			s = new Submission (id, project, sink, TestCode);

			if (DebugTree)
				Debug = instrumented;

			this.evaluator.PushSubmission (s);
		}