IronPython.Runtime.Binding.MetaPythonFunction.BindDeleteMember C# (CSharp) Method

BindDeleteMember() public method

public BindDeleteMember ( DeleteMemberBinder binder ) : DynamicMetaObject
binder DeleteMemberBinder
return DynamicMetaObject
        public override DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder) {
            switch (binder.Name) {
                case "func_dict":
                case "__dict__":
                    return new DynamicMetaObject(
                        Expression.Call(
                            typeof(PythonOps).GetMethod("PythonFunctionDeleteDict")
                        ),
                        BindingRestrictions.GetTypeRestriction(Expression, typeof(PythonFunction))
                    );
                case "__doc__":
                case "func_doc":
                    return new DynamicMetaObject(
                        Expression.Call(
                            typeof(PythonOps).GetMethod("PythonFunctionDeleteDoc"),
                            Expression.Convert(Expression, typeof(PythonFunction))
                        ),
                        BindingRestrictions.GetTypeRestriction(Expression, typeof(PythonFunction))
                    );
                case "func_defaults":
                    return new DynamicMetaObject(
                        Expression.Call(
                            typeof(PythonOps).GetMethod("PythonFunctionDeleteDefaults"),
                            Expression.Convert(Expression, typeof(PythonFunction))
                        ),
                        BindingRestrictions.GetTypeRestriction(Expression, typeof(PythonFunction))
                    ); 
            }

            // first get the default binder value
            DynamicMetaObject fallback = binder.FallbackDeleteMember(this);

            // then fallback w/ an error suggestion that does a late bound delete
            return binder.FallbackDeleteMember(
                this,
                new DynamicMetaObject(
                    Expression.Condition(
                        Ast.Call(
                            typeof(PythonOps).GetMethod("PythonFunctionDeleteMember"),
                            AstUtils.Convert(
                                Expression,
                                typeof(PythonFunction)
                            ),
                            Expression.Constant(binder.Name)
                        ),
                        Expression.Default(typeof(void)),       // we deleted the member
                        AstUtils.Convert(
                            fallback.Expression,                // report language specific error,
                            typeof(void)
                        )
                    ),
                    BindingRestrictions.GetTypeRestriction(Expression, typeof(PythonFunction)).Merge(fallback.Restrictions)
                )
            );
        }