Microsoft.Scripting.Actions.ErrorInfo.FromValueNoError C# (CSharp) Метод

FromValueNoError() публичный статический Метод

Crates a new ErrorInfo which represents a value which should be returned to the user but does not represent an error.
public static FromValueNoError ( Expression resultValue ) : ErrorInfo
resultValue System.Linq.Expressions.Expression
Результат ErrorInfo
        public static ErrorInfo FromValueNoError(Expression resultValue) {
            ContractUtils.RequiresNotNull(resultValue, "resultValue");

            return new ErrorInfo(resultValue, ErrorInfoKind.Success);
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Called when a set is attempting to assign to a field or property from a derived class through the base class.
        ///
        /// The default behavior is to allow the assignment.
        /// </summary>
        public virtual ErrorInfo MakeStaticAssignFromDerivedTypeError(Type accessingType, DynamicMetaObject self, MemberTracker assigning, DynamicMetaObject assignedValue, OverloadResolverFactory context)
        {
            switch (assigning.MemberType)
            {
            case TrackerTypes.Property:
                PropertyTracker pt     = (PropertyTracker)assigning;
                MethodInfo      setter = pt.GetSetMethod() ?? pt.GetSetMethod(true);
                return(ErrorInfo.FromValueNoError(
                           AstUtils.SimpleCallHelper(
                               setter,
                               ConvertExpression(
                                   assignedValue.Expression,
                                   setter.GetParameters()[0].ParameterType,
                                   ConversionResultKind.ExplicitCast,
                                   context
                                   )
                               )
                           ));

            case TrackerTypes.Field:
                FieldTracker ft = (FieldTracker)assigning;
                return(ErrorInfo.FromValueNoError(
                           Expression.Assign(
                               Expression.Field(null, ft.Field),
                               ConvertExpression(assignedValue.Expression, ft.FieldType, ConversionResultKind.ExplicitCast, context)
                               )
                           ));

            default:
                throw new InvalidOperationException();
            }
        }
All Usage Examples Of Microsoft.Scripting.Actions.ErrorInfo::FromValueNoError