private void Process(ScriptChunkResult result) { if (result.IsPendingClosing) { Print(new string(' ', InputStartMarker.Length)); return; } IsComplete = true; _script.AppendChunk(this); _script.AppendMemberNames(result.NewMemberNames); if (result.CompileTimeException != null) { _display.OutputCompileTimeException(result.CompileTimeException); return; } result.Execute(); if (result.RunTimeException != null) { _display.OutputRunTimeException(result.RunTimeException); return; } if (result.ReturnValue != null) { _display.OutputResult(result.ReturnValue); } }
public ScriptChunkResult Process(string input) { var result = new ScriptChunkResult(); var command = _commands.Get(input); if (command != null) { try { result.SetExecuteAction(() => command.Execute()); } catch (Exception ex) { result.RunTimeException = ex; } return(result); } try { var submission = _runtimeSession.CompileSubmission <object>(input ?? ""); if (submission.Compilation != null && submission.Compilation.ScriptClass != null && submission.Compilation.ScriptClass.MemberNames != null) { result.NewMemberNames = submission.Compilation.ScriptClass.MemberNames; } result.SetExecuteAction(submission.Execute); } catch (Exception ex) { Debug.WriteLine(ex.Message); result.UpdateClosingExpectation(ex); if (!result.IsExpectingClosingChar.HasValue) { result.CompileTimeException = ex; } } return(result); }