本文整理汇总了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)));
}
示例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);
}
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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));
}
示例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;
}
示例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);
}
示例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)));
}