当前位置: 首页>>代码示例>>C#>>正文


C# ArgumentValues类代码示例

本文整理汇总了C#中ArgumentValues的典型用法代码示例。如果您正苦于以下问题:C# ArgumentValues类的具体用法?C# ArgumentValues怎么用?C# ArgumentValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ArgumentValues类属于命名空间,在下文中一共展示了ArgumentValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SlotInitAdapter

 public SlotInitAdapter(PythonTypeSlot/*!*/ slot, ArgumentValues/*!*/ ai, PythonContext/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
     _slot = slot;
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:4,代码来源:MetaPythonType.Calls.cs

示例2: BuiltinInitAdapter

 public BuiltinInitAdapter(ArgumentValues/*!*/ ai, BuiltinFunction/*!*/ method, PythonContext/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
     _method = method;
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:4,代码来源:MetaPythonType.Calls.cs

示例3: ConstructorNewAdapter

 public ConstructorNewAdapter(ArgumentValues/*!*/ ai, PythonType/*!*/ creating, PythonContext/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
     _creating = creating;
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:4,代码来源:MetaPythonType.Calls.cs

示例4: BuiltinNewAdapter

 public BuiltinNewAdapter(ArgumentValues/*!*/ ai, PythonType/*!*/ creating, BuiltinFunction/*!*/ ctor, PythonContext/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
     _creating = creating;
     _ctor = ctor;
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:5,代码来源:MetaPythonType.Calls.cs

示例5: GetErrorRestrictions

        private BindingRestrictions/*!*/ GetErrorRestrictions(ArgumentValues/*!*/ ai) {
            BindingRestrictions res = Restrict(this.GetRuntimeType()).Restrictions;
            res = res.Merge(GetInstanceRestriction(ai));

            foreach (DynamicMetaObject mo in ai.Arguments) {
                if (mo.HasValue) {
                    res = res.Merge(mo.Restrict(mo.GetRuntimeType()).Restrictions);
                }
            }

            return res;
        }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:12,代码来源:MetaPythonType.Calls.cs

示例6: DefaultNewAdapter

 public DefaultNewAdapter(ArgumentValues/*!*/ ai, PythonType/*!*/ creating, BinderState/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
     _creating = creating;
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:4,代码来源:MetaPythonType.Calls.cs

示例7: GetAdapters

        private void GetAdapters(ArgumentValues/*!*/ ai, DynamicMetaObjectBinder/*!*/ call, Expression/*!*/ codeContext, out NewAdapter/*!*/ newAdapter, out InitAdapter/*!*/ initAdapter) {
            PythonTypeSlot newInst, init;

            Value.TryResolveSlot(PythonContext.GetPythonContext(call).SharedContext, "__new__", out newInst);
            Value.TryResolveSlot(PythonContext.GetPythonContext(call).SharedContext, "__init__", out init);

            // these are never null because we always resolve to __new__ or __init__ somewhere.
            Assert.NotNull(newInst, init);

            newAdapter = GetNewAdapter(ai, newInst, call, codeContext);
            initAdapter = GetInitAdapter(ai, init, call, codeContext);
        }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:12,代码来源:MetaPythonType.Calls.cs

示例8: MakeGenericTypeDefinitionError

        private DynamicMetaObject/*!*/ MakeGenericTypeDefinitionError(DynamicMetaObjectBinder/*!*/ call, ArgumentValues/*!*/ ai, ValidationInfo/*!*/ valInfo) {
            Debug.Assert(Value.IsSystemType);
            string message = "cannot create instances of " + Value.Name + " because it is a generic type definition";

            return BindingHelpers.AddDynamicTestAndDefer(
                call,
                new DynamicMetaObject(
                    call.Throw(
                        Ast.New(
                            typeof(TypeErrorException).GetConstructor(new Type[] { typeof(string) }),
                            AstUtils.Constant(message)
                        ),
                        typeof(object)
                    ),
                    GetErrorRestrictions(ai)
                ),
                ai.Arguments,
                valInfo
            );
        }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:20,代码来源:MetaPythonType.Calls.cs

示例9: CallAdapter

 public CallAdapter(ArgumentValues/*!*/ ai, PythonContext/*!*/ state, Expression/*!*/ codeContext) {
     _argInfo = ai;
     _state = state;
     _restrictions = BindingRestrictions.Empty;
     _context = codeContext;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:6,代码来源:MetaPythonType.Calls.cs

示例10: MakePythonTypeCall

        /// <summary>
        /// Creating a Python type involves calling __new__ and __init__.  We resolve them
        /// and generate calls to either the builtin funcions directly or embed sites which
        /// call the slots at runtime.
        /// </summary>
        private DynamicMetaObject/*!*/ MakePythonTypeCall(DynamicMetaObjectBinder/*!*/ call, Expression/*!*/ codeContext, DynamicMetaObject/*!*/[]/*!*/ args) {
            ValidationInfo valInfo = MakeVersionCheck();

            DynamicMetaObject self = new RestrictedMetaObject(
                AstUtils.Convert(Expression, LimitType),
                BindingRestrictionsHelpers.GetRuntimeTypeRestriction(Expression, LimitType),
                Value
            );
            CallSignature sig = BindingHelpers.GetCallSignature(call);
            ArgumentValues ai = new ArgumentValues(sig, self, args);
            NewAdapter newAdapter;
            InitAdapter initAdapter;

            if (TooManyArgsForDefaultNew(call, args)) {
                return MakeIncorrectArgumentsForCallError(call, ai, valInfo);
            } else if (Value.UnderlyingSystemType.IsGenericTypeDefinition()) {
                return MakeGenericTypeDefinitionError(call, ai, valInfo);
            } else if (Value.HasAbstractMethods(PythonContext.GetPythonContext(call).SharedContext)) {
                return MakeAbstractInstantiationError(call, ai, valInfo);
            }

            DynamicMetaObject translated = BuiltinFunction.TranslateArguments(call, codeContext, self, args, false, Value.Name);
            if (translated != null) {
                return translated;
            }

            GetAdapters(ai, call, codeContext, out newAdapter, out initAdapter);
            PythonContext state = PythonContext.GetPythonContext(call);
            
            // get the expression for calling __new__
            DynamicMetaObject createExpr = newAdapter.GetExpression(state.Binder);
            if (createExpr.Expression.Type == typeof(void)) {
                return BindingHelpers.AddDynamicTestAndDefer(
                    call,
                    createExpr,
                    args,                        
                    valInfo
                );                    
            }

            Expression res;
            BindingRestrictions additionalRestrictions = BindingRestrictions.Empty;
            if (!Value.IsSystemType && (!(newAdapter is DefaultNewAdapter) || HasFinalizer(call))) {
                // we need to dynamically check the return value to see if it's a subtype of
                // the type that we are calling.  If it is then we need to call __init__/__del__
                // for the actual returned type.
                res = DynamicExpression.Dynamic(
                    Value.GetLateBoundInitBinder(sig),
                    typeof(object),
                    ArrayUtils.Insert(
                        codeContext,
                        Expression.Convert(createExpr.Expression, typeof(object)),
                        DynamicUtils.GetExpressions(args)
                    )
                );
                additionalRestrictions = createExpr.Restrictions;
            } else {
                // just call the __init__ method, built-in types currently have
                // no wacky return values which don't return the derived type.

                // then get the statement for calling __init__
                ParameterExpression allocatedInst = Ast.Variable(createExpr.GetLimitType(), "newInst");
                Expression tmpRead = allocatedInst;
                DynamicMetaObject initCall = initAdapter.MakeInitCall(
                    state.Binder,
                    new RestrictedMetaObject(
                        AstUtils.Convert(allocatedInst, Value.UnderlyingSystemType),
                        createExpr.Restrictions
                    )
                );

                List<Expression> body = new List<Expression>();
                Debug.Assert(!HasFinalizer(call));

                // add the call to init if we need to
                if (initCall.Expression != tmpRead) {
                    // init can fail but if __new__ returns a different type
                    // no exception is raised.
                    DynamicMetaObject initStmt = initCall;

                    if (body.Count == 0) {
                        body.Add(
                            Ast.Assign(allocatedInst, createExpr.Expression)
                        );
                    }

                    if (!Value.UnderlyingSystemType.IsAssignableFrom(createExpr.Expression.Type)) {
                        // return type of object, we need to check the return type before calling __init__.
                        body.Add(
                            AstUtils.IfThen(
                                Ast.TypeIs(allocatedInst, Value.UnderlyingSystemType),
                                initStmt.Expression
                            )
                        );
                    } else {
//.........这里部分代码省略.........
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:101,代码来源:MetaPythonType.Calls.cs

示例11: DefaultInitAdapter

 public DefaultInitAdapter(ArgumentValues/*!*/ ai, BinderState/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:3,代码来源:MetaPythonType.Calls.cs

示例12: InitAdapter

 protected InitAdapter(ArgumentValues/*!*/ ai, BinderState/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:3,代码来源:MetaPythonType.Calls.cs

示例13: MixedNewAdapter

 public MixedNewAdapter(ArgumentValues/*!*/ ai, BinderState/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:3,代码来源:MetaPythonType.Calls.cs

示例14: MixedInitAdapter

 public MixedInitAdapter(ArgumentValues/*!*/ ai, PythonContext/*!*/ state, Expression/*!*/ codeContext)
     : base(ai, state, codeContext) {
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:3,代码来源:MetaPythonType.Calls.cs

示例15: GetInitAdapter

 private InitAdapter/*!*/ GetInitAdapter(ArgumentValues/*!*/ ai, PythonTypeSlot/*!*/ init, DynamicMetaObjectBinder/*!*/ call, Expression/*!*/ codeContext) {
     PythonContext state = PythonContext.GetPythonContext(call);
     if (Value.IsMixedNewStyleOldStyle()) {
         return new MixedInitAdapter(ai, state, codeContext);
     } else if ((init == InstanceOps.Init && !HasFinalizer(call)) || (Value == TypeCache.PythonType && ai.Arguments.Length == 2)) {
         return new DefaultInitAdapter(ai, state, codeContext);
     } else if (init is BuiltinMethodDescriptor) {
         return new BuiltinInitAdapter(ai, ((BuiltinMethodDescriptor)init).Template, state, codeContext);
     } else if (init is BuiltinFunction) {
         return new BuiltinInitAdapter(ai, (BuiltinFunction)init, state, codeContext);
     } else {
         return new SlotInitAdapter(init, ai, state, codeContext);
     }
 }
开发者ID:CookieEaters,项目名称:FireHTTP,代码行数:14,代码来源:MetaPythonType.Calls.cs


注:本文中的ArgumentValues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。