• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Binding.BinderState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AstGenerator

        internal AstGenerator(AstGenerator/*!*/ parent, string name, bool generator, string profilerName)
            : this(name, generator, profilerName, false) {
            Assert.NotNull(parent);
            _context = parent.Context;
            _binderState = parent.BinderState;
            _parent = parent;
            _document = _context.SourceUnit.Document ?? Ast.SymbolDocument(name, PythonContext.LanguageGuid, PythonContext.VendorGuid);
            _profiler = parent._profiler;

            _globals = parent._globals;
        }
开发者ID:m4dc4p,项目名称:ironruby,代码行数:11,代码来源:AstGenerator.cs


示例17: Invoke

 public static Expression/*!*/ Invoke(Expression codeContext, BinderState/*!*/ binder, Type/*!*/ resultType, CallSignature signature, params Expression/*!*/[]/*!*/ args) {
     return Ast.Dynamic(
         binder.Invoke(
             signature
         ),
         resultType,
         ArrayUtils.Insert(codeContext, args)
     );
 }
开发者ID:m4dc4p,项目名称:ironruby,代码行数:9,代码来源:BindingHelpers.cs


示例18: GetConvertByLengthBody

        /// <summary>
        /// Used for conversions to bool
        /// </summary>
        private static Expression/*!*/ GetConvertByLengthBody(BinderState/*!*/ state, Expression/*!*/ call) {
            Assert.NotNull(state, call);

            Expression callAsInt = call;
            if (call.Type != typeof(int)) {
                callAsInt = Ast.Dynamic(
                    state.Convert(typeof(int), ConversionResultKind.ExplicitCast),
                    typeof(int),
                    call
                );
            }

            return Ast.NotEqual(callAsInt, AstUtils.Constant(0));
        }
开发者ID:m4dc4p,项目名称:ironruby,代码行数:17,代码来源:PythonProtocol.cs


示例19: MakeGetItemIterable

 private static DynamicMetaObject MakeGetItemIterable(DynamicMetaObject metaUserObject, BinderState state, PythonTypeSlot pts, string method) {
     ParameterExpression tmp = Ast.Parameter(typeof(object), "getitemVal");
     return new DynamicMetaObject(
         Expression.Block(
             new[] { tmp },
             Expression.Call(
                 typeof(PythonOps).GetMethod(method),
                 Ast.Block(
                     MetaPythonObject.MakeTryGetTypeMember(
                         state,
                         pts,
                         tmp,
                         metaUserObject.Expression,
                         Ast.Call(
                             typeof(DynamicHelpers).GetMethod("GetPythonType"),
                             AstUtils.Convert(
                                 metaUserObject.Expression,
                                 typeof(object)
                             )
                         )
                     ),
                     tmp
                 ),
                 AstUtils.Constant(
                     CallSite<Func<CallSite, CodeContext, object, int, object>>.Create(
                         new PythonInvokeBinder(state, new CallSignature(1))
                     )
                 )
             )
         ),
         metaUserObject.Restrictions
     );
 }
开发者ID:m4dc4p,项目名称:ironruby,代码行数:33,代码来源:PythonProtocol.cs


示例20: AstGenerator

        internal AstGenerator(CompilationMode mode, CompilerContext/*!*/ context, SourceSpan span, string name, bool generator, bool print)
            : this(name, generator, null, print) {
            Assert.NotNull(context);
            _context = context;
            _binderState = new BinderState(Binder);
            _document = _context.SourceUnit.Document;

            LanguageContext pc = context.SourceUnit.LanguageContext;
            switch (mode) {
                case CompilationMode.Collectable: _globals = new ArrayGlobalAllocator(pc); break;
                case CompilationMode.Lookup: _globals = new DictionaryGlobalAllocator(); break;
                case CompilationMode.ToDisk: _globals = new SavableGlobalAllocator(pc); break;
                case CompilationMode.Uncollectable: _globals = new StaticGlobalAllocator(pc, name); break;
            }

            PythonOptions po = (pc.Options as PythonOptions);
            Assert.NotNull(po);
            if (po.EnableProfiler && mode != CompilationMode.ToDisk) {
                _profiler = Profiler.GetProfiler(PythonContext);
                if (mode == CompilationMode.Lookup) {
                    _profilerName = NameForExec;
                }
            }
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:24,代码来源:AstGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Binding.PythonBinder类代码示例发布时间:2022-05-26
下一篇:
C# Runtime.WeakRefTracker类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap