public virtual ICollection <MemberDoc> GetMemberNames(string expression) { var source = _engine.CreateScriptSourceFromString(expression, SourceCodeKind.Expression); var errors = new DlrErrorListener(); if (ShouldEvaluateForCompletion(expression)) { var command = source.Compile(CompilerOptions, errors); if (command == null) { return(new MemberDoc[0]); } ObjectHandle exception, obj = command.ExecuteAndWrap(_currentScope, out exception); if (exception == null) { var docOps = _engine.GetService <DocumentationOperations>(); if (docOps != null) { return(docOps.GetMembers(obj)); } return(new List <MemberDoc>( _engine.Operations.GetMemberNames(obj).Select( x => new MemberDoc(x, MemberKind.None) ) )); } } return(new MemberDoc[0]); }
public virtual ICollection <OverloadDoc> GetSignatureDocumentation(string expression) { var source = _engine.CreateScriptSourceFromString(expression, SourceCodeKind.Expression); if (ShouldEvaluateForCompletion(expression)) { var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { return(new OverloadDoc[0]); } ObjectHandle exception, obj = command.ExecuteAndWrap(_currentScope, out exception); if (exception == null) { var docOps = _engine.GetService <DocumentationOperations>(); if (docOps != null) { return(docOps.GetOverloads(obj)); } return(new[] { new OverloadDoc( "", _engine.Operations.GetDocumentation(obj), new ParameterDoc[0] ) }); } } return(new OverloadDoc[0]); }
public override bool CheckSyntax(string text, SourceCodeKind kind) { var source = _engine.CreateScriptSourceFromString(text, SourceCodeKind); var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { if (errors.Errors.Count > 0) { WriteException(new ObjectHandle(errors.Errors[0])); } return(false); } return(true); }
private bool ExecuteTextInScopeWorker(string text, ScriptScope scope, SourceCodeKind kind, Action <ObjectHandle, ObjectHandle> completionFunction) { var source = _engine.CreateScriptSourceFromString(text, kind); var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { if (errors.Errors.Count > 0) { WriteException(new ObjectHandle(errors.Errors[0])); } return(false); } // Allow re-entrant execution. Dispatcher.BeginInvoke(new Action(() => { ObjectHandle result = null; ObjectHandle exception = null; try { result = command.ExecuteAndWrap(scope, out exception); } catch (ThreadAbortException e) { if (e.ExceptionState != null) { exception = new ObjectHandle(e.ExceptionState); } else { exception = new ObjectHandle(e); } if ((Thread.CurrentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0) { Thread.ResetAbort(); } } catch (RemotingException) { WriteLine("Communication with the remote process has been disconnected."); } catch (Exception e) { exception = new ObjectHandle(e); } if (completionFunction != null) { completionFunction(result, exception); } })); return(true); }
private bool ExecuteTextInScopeWorker(string text, ScriptScope scope, SourceCodeKind kind, Action<ObjectHandle, ObjectHandle> completionFunction) { var source = _engine.CreateScriptSourceFromString(text, kind); var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { if (errors.Errors.Count > 0) { WriteException(new ObjectHandle(errors.Errors[0])); } return false; } // Allow re-entrant execution. Dispatcher.BeginInvoke(new Action(() => { ObjectHandle result = null; ObjectHandle exception = null; try { result = command.ExecuteAndWrap(scope, out exception); } catch (ThreadAbortException e) { if (e.ExceptionState != null) { exception = new ObjectHandle(e.ExceptionState); } else { exception = new ObjectHandle(e); } if ((Thread.CurrentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0) { Thread.ResetAbort(); } } catch (RemotingException) { WriteLine("Communication with the remote process has been disconnected."); } catch (Exception e) { exception = new ObjectHandle(e); } if (completionFunction != null) { completionFunction(result, exception); } })); return true; }
public virtual ICollection<OverloadDoc> GetSignatureDocumentation(string expression) { var source = _engine.CreateScriptSourceFromString(expression, SourceCodeKind.Expression); if (ShouldEvaluateForCompletion(expression)) { var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { return new OverloadDoc[0]; } ObjectHandle exception, obj = command.ExecuteAndWrap(_currentScope, out exception); if (exception == null) { var docOps = _engine.GetService<DocumentationOperations>(); if (docOps != null) { return docOps.GetOverloads(obj); } return new[] { new OverloadDoc( "", _engine.Operations.GetDocumentation(obj), new ParameterDoc[0] ) }; } } return new OverloadDoc[0]; }
public virtual ICollection<MemberDoc> GetMemberNames(string expression) { var source = _engine.CreateScriptSourceFromString(expression, SourceCodeKind.Expression); var errors = new DlrErrorListener(); if (ShouldEvaluateForCompletion(expression)) { var command = source.Compile(CompilerOptions, errors); if (command == null) { return new MemberDoc[0]; } ObjectHandle exception, obj = command.ExecuteAndWrap(_currentScope, out exception); if (exception == null) { var docOps = _engine.GetService<DocumentationOperations>(); if (docOps != null) { return docOps.GetMembers(obj); } return new List<MemberDoc>( _engine.Operations.GetMemberNames(obj).Select( x => new MemberDoc(x, MemberKind.None) ) ); } } return new MemberDoc[0]; }
public override bool CheckSyntax(string text, SourceCodeKind kind) { var source = _engine.CreateScriptSourceFromString(text, SourceCodeKind); var errors = new DlrErrorListener(); var command = source.Compile(CompilerOptions, errors); if (command == null) { if (errors.Errors.Count > 0) { WriteException(new ObjectHandle(errors.Errors[0])); } return false; } return true; }