/// <summary> /// Executes an already analysed script. /// The result object must be disposed before executing another piece of code. /// You can use the static <see cref="Evaluate(Expr, GlobalContext)"/> for simple scenarios. /// </summary> /// <param name="s">The string to execute.</param> /// <returns>A result that may be pending...</returns> public Result Execute(Expr e) { if (_currentResult != null) { throw new InvalidOperationException(); } _currentResult = StartExecution(); _currentResult.UpdateStatus(_visitor.VisitExpr(e)); return(_currentResult); }
public bool IsPendingOrSignal(ref PExpr current, Expr e) { if (current.IsResolved) { return(false); } if (current.IsUnknown) { current = Visitor.VisitExpr(e); } else { current = Visitor.StepOver(current.Frame, StepOverKind.InternalStepOver); } return(current.IsPendingOrSignal); }
/// <summary> /// Simple static helper to evaluate an expression (typically a pure expression without side effects). /// </summary> /// <param name="e">The expression to evaluate.</param> /// <param name="ctx">The <see cref="GlobalContext"/>. When null, a new default GlobalContext is used.</param> /// <returns>The result of the evaluation.</returns> public static RuntimeObj Evaluate( Expr e, GlobalContext ctx = null ) { EvalVisitor v = new EvalVisitor( ctx ?? new GlobalContext() ); return v.VisitExpr( e ).Result; }
/// <summary> /// Simple static helper to evaluate an expression (typically a pure expression without side effects). /// </summary> /// <param name="e">The expression to evaluate.</param> /// <param name="ctx">The <see cref="GlobalContext"/>. When null, a new default GlobalContext is used.</param> /// <returns>The result of the evaluation.</returns> public static RuntimeObj Evaluate(Expr e, GlobalContext ctx = null) { EvalVisitor v = new EvalVisitor(ctx ?? new GlobalContext()); return(v.VisitExpr(e).Result); }