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


C# Binding.BinderState类代码示例

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


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

示例1: ConversionBinder

        public ConversionBinder(BinderState/*!*/ state, Type/*!*/ type, ConversionResultKind resultKind)
            : base(type, resultKind == ConversionResultKind.ExplicitCast || resultKind == ConversionResultKind.ExplicitTry) {
            Assert.NotNull(state, type);

            _state = state;
            _kind = resultKind;
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:7,代码来源:ConversionBinder.cs

示例2: AstGenerator

 internal AstGenerator(AstGenerator/*!*/ parent, string name, bool generator, bool print)
     : this(name, generator, false) {
     Assert.NotNull(parent);
     _context = parent.Context;
     _binderState = parent.BinderState;
     _document = _context.SourceUnit.Document;
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:7,代码来源:AstGenerator.cs

示例3: Convert

 /// <summary>
 /// Backwards compatible Convert for the old sites that need to flow CodeContext
 /// </summary>
 public static Expression/*!*/ Convert(Expression/*!*/ codeContext, BinderState/*!*/ binder, Type/*!*/ type, ConversionResultKind resultKind, Expression/*!*/ target) {
     return Ast.Dynamic(
         binder.Convert(type, resultKind),
         type,
         target
     );
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:10,代码来源:Binders.cs

示例4: Get

 public static Expression/*!*/ Get(Expression/*!*/ codeContext, BinderState/*!*/ binder, Type/*!*/ resultType, string/*!*/ name, Expression/*!*/ target) {
     return Ast.Dynamic(
         binder.GetMember(name),
         resultType,
         target,
         codeContext
     );
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:8,代码来源:Binders.cs

示例5: Operation

 public static Expression/*!*/ Operation(BinderState/*!*/ binder, Type/*!*/ resultType, string/*!*/ operation, Expression arg0) {
     return Ast.Dynamic(
         new PythonOperationBinder(
             binder,
             operation
         ),
         resultType,
         arg0
     );
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:10,代码来源:Binders.cs

示例6: Convert

 public static Expression/*!*/ Convert(BinderState/*!*/ binder, Type/*!*/ type, ConversionResultKind resultKind, Expression/*!*/ target) {
     return Ast.Dynamic(
         new ConversionBinder(
             binder,
             type,
             resultKind
         ),
         type,
         target
     );
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:11,代码来源:Binders.cs

示例7: UnaryOperationBinder

        public static DynamicMetaObjectBinder UnaryOperationBinder(BinderState state, PythonOperationKind operatorName) {
            ExpressionType? et = GetExpressionTypeFromUnaryOperator(operatorName);
            
            if (et == null) {
                return state.Operation(
                    operatorName
                );
            }

            return state.UnaryOperation(et.Value);
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:11,代码来源:Binders.cs

示例8: MakeTryGetTypeMember

 internal static MethodCallExpression MakeTryGetTypeMember(BinderState/*!*/ binderState, PythonTypeSlot dts, ParameterExpression tmp, Expression instance, Expression pythonType) {
     return Ast.Call(
         TypeInfo._PythonOps.SlotTryGetBoundValue,
         Ast.Constant(binderState.Context),
         AstUtils.Convert(Utils.WeakConstant(dts), typeof(PythonTypeSlot)),
         AstUtils.Convert(instance, typeof(object)),
         AstUtils.Convert(
             pythonType,
             typeof(PythonType)
         ),
         tmp
     );
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:13,代码来源:MetaPythonObject.cs

示例9: BinaryOperationRetType

 public static DynamicMetaObjectBinder/*!*/ BinaryOperationRetType(BinderState/*!*/ state, PythonOperationKind operatorName, Type retType) {
     return new ComboBinder(
         new BinderMappingInfo(
             BinaryOperationBinder(state, operatorName),
             ParameterMappingInfo.Parameter(0),
             ParameterMappingInfo.Parameter(1)
         ),
         new BinderMappingInfo(
             state.Convert(retType, ConversionResultKind.ExplicitCast),
             ParameterMappingInfo.Action(0)
         )
     );
 }
开发者ID:jcteague,项目名称:ironruby,代码行数:13,代码来源:Binders.cs

示例10: TryGetStaticFunction

 /// <summary>
 /// Trys to get the BuiltinFunction for the given name on the type of the provided MetaObject.  
 /// 
 /// Succeeds if the MetaObject is a BuiltinFunction or BuiltinMethodDescriptor.
 /// </summary>
 internal static bool TryGetStaticFunction(BinderState/*!*/ state, SymbolId op, DynamicMetaObject/*!*/ mo, out BuiltinFunction function) {
     PythonType type = MetaPythonObject.GetPythonType(mo);
     function = null;
     if (op != SymbolId.Empty) {
         PythonTypeSlot xSlot;
         object val;
         if (type.TryResolveSlot(state.Context, op, out xSlot) &&
             xSlot.TryGetValue(state.Context, null, type, out val)) {
             function = TryConvertToBuiltinFunction(val);
             if (function == null) return false;
         }
     }
     return true;
 }
开发者ID:m4dc4p,项目名称:ironruby,代码行数:19,代码来源:BindingHelpers.cs

示例11: Invoke

        public static Expression/*!*/ Invoke(BinderState/*!*/ binder, Type/*!*/ resultType, CallSignature signature, params Expression/*!*/[]/*!*/ args) {
            PythonInvokeBinder invoke = new PythonInvokeBinder(binder, signature);
            switch(args.Length) {
                case 0: return Ast.Dynamic(invoke, resultType, AstUtils.CodeContext());
                case 1: return Ast.Dynamic(invoke, resultType, AstUtils.CodeContext(), args[0]);
                case 2: return Ast.Dynamic(invoke, resultType, AstUtils.CodeContext(), args[0], args[1]);
                case 3: return Ast.Dynamic(invoke, resultType, AstUtils.CodeContext(), args[0], args[1], args[2]);
                default:
                    return Ast.Dynamic(
                        invoke,
                        resultType,
                        new ReadOnlyCollection<Expression>(ArrayUtils.Insert(AstUtils.CodeContext(), args))
                    );
            }

        }
开发者ID:octavioh,项目名称:ironruby,代码行数:16,代码来源:Binders.cs

示例12: FallbackGetMember

        private DynamicMetaObject/*!*/ FallbackGetMember(DynamicMetaObjectBinder member, BinderState state) {
            MemberTracker tt = MemberTracker.FromMemberInfo(Value.UnderlyingSystemType);

            if (member is IPythonSite) {
                // bind the .NET members
                string memberName = GetGetMemberName(member);
                return state.Binder.GetMember(
                    memberName,
                    new DynamicMetaObject(
                        Ast.Constant(tt),
                        BindingRestrictions.Empty,
                        tt
                    ),
                    Ast.Constant(state.Context),
                    BindingHelpers.IsNoThrow(member)

                );
            }

            // let the calling language bind the .NET members
            return GetMemberFallback(this, member, BinderState.GetCodeContext(member));
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:22,代码来源:MetaPythonType.Members.cs

示例13: GetFallbackGet

        private DynamicMetaObject/*!*/ GetFallbackGet(DynamicMetaObjectBinder/*!*/ member, BinderState/*!*/ state, Expression codeContext) {
            string memberName = GetGetMemberName(member);
            DynamicMetaObject res = new DynamicMetaObject(
                FallbackGetMember(member, state).Expression,
                BindingRestrictions.GetInstanceRestriction(Expression, Value).Merge(Restrictions)
            );

            if (codeContext != null && Value.IsHiddenMember(memberName)) {
                res = BindingHelpers.FilterShowCls(
                    codeContext,
                    member,
                    res,
                    Ast.Throw(
                        Ast.Call(
                            typeof(PythonOps).GetMethod("AttributeErrorForMissingAttribute", new Type[] { typeof(string), typeof(SymbolId) }),
                            AstUtils.Constant(Value.Name),
                            AstUtils.Constant(SymbolTable.StringToId(memberName))
                        )
                    )
                );
            }

            return res;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:24,代码来源:MetaPythonType.Members.cs

示例14: PythonGetMemberBinder

 public PythonGetMemberBinder(BinderState/*!*/ binder, string/*!*/ name) {
     _state = binder;
     _name = name;
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:4,代码来源:PythonGetMemberBinder.cs

示例15: CompatibilityGetMember

 public CompatibilityGetMember(BinderState/*!*/ binder, string/*!*/ name)
     : this(binder, name, false) {
 }
开发者ID:octavioh,项目名称:ironruby,代码行数:3,代码来源:PythonGetMemberBinder.cs


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