コード例 #1
0
 public ObjectValue GetExpressionValue(EvaluationContext ctx, string exp)
 {
     try {
         ValueReference var = ctx.Evaluator.Evaluate(ctx, exp);
         if (var != null)
         {
             return(var.CreateObjectValue(ctx.Options));
         }
         else
         {
             return(ObjectValue.CreateUnknown(exp));
         }
     }
     catch (ImplicitEvaluationDisabledException) {
         return(ObjectValue.CreateImplicitNotSupported(ctx.ExpressionValueSource, new ObjectPath(exp), "", ObjectValueFlags.None));
     }
     catch (NotSupportedExpressionException ex) {
         return(ObjectValue.CreateNotSupported(ctx.ExpressionValueSource, new ObjectPath(exp), ex.Message, "", ObjectValueFlags.None));
     }
     catch (EvaluatorException ex) {
         return(ObjectValue.CreateError(ctx.ExpressionValueSource, new ObjectPath(exp), "", ex.Message, ObjectValueFlags.None));
     }
     catch (Exception ex) {
         ctx.WriteDebuggerError(ex);
         return(ObjectValue.CreateUnknown(exp));
     }
 }