本文整理汇总了C#中PValue.IndirectCall方法的典型用法代码示例。如果您正苦于以下问题:C# PValue.IndirectCall方法的具体用法?C# PValue.IndirectCall怎么用?C# PValue.IndirectCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PValue
的用法示例。
在下文中一共展示了PValue.IndirectCall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _invokeHandler
private static PValue _invokeHandler(StackContext sctx, PValue handler, PValue datum,
bool performSubCall)
{
var handlerArgv = datum != null ? new[] {datum} : Runtime.EmptyPValueArray;
return performSubCall
? CallSubPerform.RunStatically(sctx, handler, handlerArgv,
useIndirectCallAsFallback: true)
: handler.IndirectCall(sctx, handlerArgv);
}
示例2: RunStatically
public static PValue RunStatically(StackContext sctx, PValue fpv, PValue[] iargs,
bool useIndirectCallAsFallback)
{
IStackAware f;
IMaybeStackAware m;
CilClosure cilClosure;
PFunction func = null;
PVariable[] sharedVars = null;
PValue result;
ReturnMode returnMode;
if ((cilClosure = fpv.Value as CilClosure) != null)
{
func = cilClosure.Function;
sharedVars = cilClosure.SharedVariables;
}
if ((func = func ?? fpv.Value as PFunction) != null && func.HasCilImplementation)
{
func.CilImplementation.Invoke(
func, CilFunctionContext.New(sctx, func), iargs, sharedVars ?? new PVariable[0],
out result, out returnMode);
}
else if ((f = fpv.Value as IStackAware) != null)
{
//Create stack context, let the engine execute it
var subCtx = f.CreateStackContext(sctx, iargs);
sctx.ParentEngine.Process(subCtx);
result = subCtx.ReturnValue;
returnMode = subCtx.ReturnMode;
}
else if ((m = fpv.Value as IMaybeStackAware) != null)
{
StackContext subCtx;
if (m.TryDefer(sctx, iargs, out subCtx, out result))
{
sctx.ParentEngine.Process(subCtx);
result = subCtx.ReturnValue;
returnMode = subCtx.ReturnMode;
}
else if (useIndirectCallAsFallback)
{
returnMode = ReturnMode.Exit;
}
else
{
throw new PrexoniteException(
string.Format(
"Invocation of {0} did not produce a valid return mode. " +
"Only Prexonite functions have a return mode.",
fpv.CallToString(sctx)));
}
}
else if (useIndirectCallAsFallback)
{
result = fpv.IndirectCall(sctx, iargs);
returnMode = ReturnMode.Exit;
}
else
{
throw new PrexoniteException(
"call\\sub\\perform requires its argument to be stack aware.");
}
return new PValueKeyValuePair(sctx.CreateNativePValue(returnMode), result);
}