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


C# CallSiteStorage.GetCallSite方法代码示例

本文整理汇总了C#中CallSiteStorage.GetCallSite方法的典型用法代码示例。如果您正苦于以下问题:C# CallSiteStorage.GetCallSite方法的具体用法?C# CallSiteStorage.GetCallSite怎么用?C# CallSiteStorage.GetCallSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CallSiteStorage的用法示例。


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

示例1: PrecInteger

        public static object PrecInteger(
            CallSiteStorage<Func<CallSite, RubyContext, object, RubyClass, object>>/*!*/ precStorage,
            RubyContext/*!*/ context, object self) {

            var prec = precStorage.GetCallSite("prec", 1);
            return prec.Target(prec, context, self, context.GetClass(typeof(Integer)));
        }
开发者ID:joshholmes,项目名称:ironruby,代码行数:7,代码来源:Precision.cs

示例2: Each

 private static object Each(CallSiteStorage<EachSite>/*!*/ each, RubyContext/*!*/ context, object self, Proc/*!*/ block) {
     var enumerator = self as Enumerator;
     if (enumerator != null) {
         return enumerator.Each(context, block);
     } else {
         var site = each.GetCallSite("each", RubyCallSignature.WithBlock(0));
         return site.Target(site, context, self, block);
     }
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:9,代码来源:Enumerable.cs

示例3: MatchRegexp

 public static object MatchRegexp(CallSiteStorage<Func<CallSite, RubyScope, RubyRegex, MutableString, object>>/*!*/ storage, 
     RubyScope/*!*/ scope, MutableString/*!*/ self, [NotNull]RubyRegex/*!*/ regex) {
     var site = storage.GetCallSite("match", new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasScope));
     return site.Target(site, scope, regex, self);
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:5,代码来源:MutableStringOps.cs

示例4: Each

 internal static object Each(CallSiteStorage<EachSiteN>/*!*/ each, object self, IList/*!*/ args, Proc/*!*/ block) {
     var site = each.GetCallSite("each", new RubyCallSignature(0, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasBlock | RubyCallFlags.HasSplattedArgument));
     return site.Target(site, self, block, args);
 }
开发者ID:rafacv,项目名称:iron_languages,代码行数:4,代码来源:Enumerable.cs

示例5: CreateResultArray

        private static IList/*!*/ CreateResultArray(CallSiteStorage<Func<CallSite, RubyClass, object>>/*!*/ allocateStorage, IList/*!*/ list) {
            // RubyArray:
            var array = list as RubyArray;
            if (array != null) {
                return array.CreateInstance();
            }
            
            // interop - call a default ctor to get an instance:
            var allocate = allocateStorage.GetCallSite("allocate", 0);
            var cls = allocateStorage.Context.GetClassOf(list);
            var result = allocate.Target(allocate, cls) as IList;
            if (result != null) {
                return result;
            }

            throw RubyExceptions.CreateTypeError(String.Format("{0}#allocate should return IList", cls.Name));
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:17,代码来源:IListOps.cs

示例6: New

        private static object New(string/*!*/ methodName, CallSiteStorage<Func<CallSite, object, object, object>>/*!*/ storage,
            TypeGroup/*!*/ self, params object[]/*!*/ args) {

            var cls = GetNonGenericClass(storage.Context, self);
            var site = storage.GetCallSite(methodName,
                new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasSplattedArgument)
            );

            return site.Target(site, cls, RubyOps.MakeArrayN(args));
        }
开发者ID:rudimk,项目名称:dlr-dotnet,代码行数:10,代码来源:TypeGroupOps.cs

示例7: HexDigest

 public static MutableString HexDigest(CallSiteStorage<Func<CallSite, object, MutableString, object>>/*!*/ storage, 
     RubyClass/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ str)
 {
     var site = storage.GetCallSite("digest", 1);
     MutableString result = (MutableString)site.Target(site, self, str);
     // TODO: check result != null
     return HexEncode(result);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:Digest.cs

示例8: Digest

            public static MutableString Digest(
                CallSiteStorage<Func<CallSite, object, MutableString, object>>/*!*/ updateStorage,
                CallSiteStorage<Func<CallSite, object, object>>/*!*/ finishStorage,
                CallSiteStorage<Func<CallSite, object, object>>/*!*/ resetStorage,
                object self, [DefaultProtocol, NotNull]MutableString/*!*/ str)
            {
                var update = updateStorage.GetCallSite("update", 1);
                update.Target(update, self, str);

                var finish = finishStorage.GetCallSite("finish", 0);
                object value = finish.Target(finish, self);

                var reset = resetStorage.GetCallSite("reset", 0);
                reset.Target(reset, self);

                // TODO: cast?
                return (MutableString)value;
            }
开发者ID:TerabyteX,项目名称:main,代码行数:18,代码来源:Digest.cs

示例9: Extend

        public static object Extend(
            CallSiteStorage<Func<CallSite, RubyModule, object, object>>/*!*/ extendObjectStorage,
            CallSiteStorage<Func<CallSite, RubyModule, object, object>>/*!*/ extendedStorage,
            object self, [NotNull]RubyModule/*!*/ module, [NotNull]params RubyModule/*!*/[]/*!*/ modules) {

            Assert.NotNull(self, modules);
            RubyUtils.RequireMixins(module.SingletonClass, modules);

            var extendObject = extendObjectStorage.GetCallSite("extend_object", 1);
            var extended = extendedStorage.GetCallSite("extended", 1);
            
            // Kernel#extend_object inserts the module at the beginning of the object's singleton ancestors list;
            // ancestors after extend: [modules[0], modules[1], ..., modules[N-1], self-singleton, ...]
            for (int i = modules.Length - 1; i >= 0; i--) {
                extendObject.Target(extendObject, modules[i], self);
                extended.Target(extended, modules[i], self);
            }

            extendObject.Target(extendObject, module, self);
            extended.Target(extended, module, self);

            return self;
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:23,代码来源:KernelOps.cs

示例10: ReadInputLine

        public static object ReadInputLine(CallSiteStorage<Func<CallSite, object, MutableString, object>>/*!*/ storage, object self, 
            [NotNull]MutableString/*!*/ separator) {

            var site = storage.GetCallSite("gets", 1);
            return site.Target(site, storage.Context.StandardInput, separator);
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:6,代码来源:KernelOps.cs

示例11: TryFlattenArray

        public static bool TryFlattenArray(
            CallSiteStorage<Func<CallSite, IList, object>>/*!*/ flattenStorage, 
            ConversionStorage<IList>/*!*/ tryToAry, 
            IList list, out IList/*!*/ result) {

            // TODO: create correct subclass of RubyArray rather than RubyArray directly
            result = new RubyArray();

            using (IDisposable handle = _infiniteFlattenTracker.TrackObject(list)) {
                if (handle == null) {
                    throw RubyExceptions.CreateArgumentError("tried to flatten recursive array");
                }
                bool flattened = false;
                for (int i = 0; i < list.Count; i++) {
                    IList item = Protocols.TryCastToArray(tryToAry, list[i]);
                    if (item != null) {
                        flattened = true;
                        var flatten = flattenStorage.GetCallSite("flatten", 0);

                        object flattenedItem = flatten.Target(flatten, item);
                        IList flattenedList = Protocols.TryCastToArray(tryToAry, flattenedItem);
                        if (flattenedList != null) {
                            AddRange(result, flattenedList);
                        } else {
                            result.Add(flattenedItem);
                        }
                    } else {
                        result.Add(list[i]);
                    }
                }
                return flattened;
            }
        }
开发者ID:MiguelMadero,项目名称:ironruby,代码行数:33,代码来源:IListOps.cs

示例12: New

        private static object/*!*/ New(string/*!*/ methodName, CallSiteStorage<Func<CallSite, object, object, object, object>>/*!*/ storage, BlockParam block, 
            TypeGroup/*!*/ self, [NotNull]params object[] args) {

            var cls = GetNonGenericClass(storage.Context, self);
            var site = storage.GetCallSite(methodName,
                new RubyCallSignature(1, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasSplattedArgument | RubyCallFlags.HasBlock)
            );

            return site.Target(site, cls, block != null ? block.Proc : null, RubyOps.MakeArrayN(args));
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:10,代码来源:TypeGroupOps.cs

示例13: CreateNew

        public static Proc/*!*/ CreateNew(CallSiteStorage<Func<CallSite, Proc, Proc, object>>/*!*/ storage,
            RubyClass/*!*/ self, Proc/*!*/ proc) {
            Assert.NotNull(storage, self, proc);

            // an instance of Proc class, the identity is preserved:
            if (self.GetUnderlyingSystemType() == typeof(Proc)) {
                return proc;
            }

            // an instance of a Proc subclass:
            var result = new Proc.Subclass(self, proc);

            var initialize = storage.GetCallSite("initialize", new RubyCallSignature(0, RubyCallFlags.HasImplicitSelf | RubyCallFlags.HasBlock));

            // a call to the initializer with a block:
            object initResult = null;
            do {
                // a new proc is created each iteration (even if a subclass is passed in, the Proc class is created):
                var argProc = proc.Create(proc);

                try {
                    initResult = initialize.Target(initialize, proc, argProc);
                } catch (EvalUnwinder u) {
                    initResult = u.ReturnValue;
                }

                Debug.Assert(proc != argProc, "retry doesn't propagate to the caller");
            } while (RubyOps.IsRetrySingleton(initResult));

            return result;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:31,代码来源:ProcOps.cs

示例14: Match

 public static object Match(CallSiteStorage<Func<CallSite, RubyContext, object, MutableString, object>>/*!*/ storage,
     RubyScope/*!*/ scope, MutableString/*!*/ self, object obj) {
     var site = storage.GetCallSite("=~", 1);
     return site.Target(site, scope.RubyContext, obj, self);
 }
开发者ID:tnachen,项目名称:ironruby,代码行数:5,代码来源:MutableStringOps.cs

示例15: PrecFloat

        public static object PrecFloat(CallSiteStorage<Func<CallSite, object, RubyClass, object>>/*!*/ precStorage, object self) {

            var prec = precStorage.GetCallSite("prec", 1);
            return prec.Target(prec, self, precStorage.Context.GetClass(typeof(double)));
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:5,代码来源:Precision.cs


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