本文整理汇总了C#中IronRuby.Runtime.RubyScope.GetInnerMostBlockOrMethodScope方法的典型用法代码示例。如果您正苦于以下问题:C# RubyScope.GetInnerMostBlockOrMethodScope方法的具体用法?C# RubyScope.GetInnerMostBlockOrMethodScope怎么用?C# RubyScope.GetInnerMostBlockOrMethodScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Runtime.RubyScope
的用法示例。
在下文中一共展示了RubyScope.GetInnerMostBlockOrMethodScope方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvalNextOrRedo
private static void EvalNextOrRedo(RubyScope/*!*/ scope, object returnValue, bool isRedo)
{
if (scope.InLoop) {
throw new BlockUnwinder(returnValue, isRedo);
}
RubyBlockScope blockScope;
RubyMethodScope methodScope;
scope.GetInnerMostBlockOrMethodScope(out blockScope, out methodScope);
if (blockScope != null) {
throw new BlockUnwinder(returnValue, isRedo);
}
throw new LocalJumpError(String.Format("unexpected {0}", isRedo ? "redo" : "next"));
}
示例2: EvalRetry
public static void EvalRetry(RubyScope/*!*/ scope)
{
if (scope.InRescue) {
throw new EvalUnwinder(BlockReturnReason.Retry, BlockReturnResult.Retry);
}
RubyBlockScope blockScope;
RubyMethodScope methodScope;
scope.GetInnerMostBlockOrMethodScope(out blockScope, out methodScope);
if (methodScope != null && methodScope.BlockParameter != null) {
throw new EvalUnwinder(BlockReturnReason.Retry, BlockReturnResult.Retry);
} else if (blockScope != null) {
if (blockScope.BlockFlowControl.CallerKind == BlockCallerKind.Yield) {
throw new EvalUnwinder(BlockReturnReason.Retry, null, blockScope.BlockFlowControl.Proc.Kind, BlockReturnResult.Retry);
}
//if (blockScope.BlockFlowControl.IsMethod) {
throw new LocalJumpError("retry from proc-closure");// TODO: RFC
}
throw new LocalJumpError("retry used out of rescue", scope.FlowControlScope);
}
示例3: EvalReturn
public static object EvalReturn(RubyScope/*!*/ scope, object returnValue)
{
RubyBlockScope blockScope;
RubyMethodScope methodScope;
scope.GetInnerMostBlockOrMethodScope(out blockScope, out methodScope);
if (blockScope != null) {
Proc proc = blockScope.BlockFlowControl.Proc;
if (blockScope.BlockFlowControl.CallerKind == BlockCallerKind.Call && proc.Kind == ProcKind.Lambda) {
throw new BlockUnwinder(returnValue, false);
}
RuntimeFlowControl owner = proc.LocalScope.FlowControlScope;
if (owner.IsActiveMethod) {
throw new MethodUnwinder(owner, returnValue);
}
throw new LocalJumpError("unexpected return");
} else {
// return from the current method:
throw new MethodUnwinder(scope.FlowControlScope, returnValue);
}
}
示例4: EvalBreak
public static void EvalBreak(RubyScope/*!*/ scope, object returnValue)
{
if (scope.InLoop) {
throw new EvalUnwinder(BlockReturnReason.Break, returnValue);
}
RubyBlockScope blockScope;
RubyMethodScope methodScope;
scope.GetInnerMostBlockOrMethodScope(out blockScope, out methodScope);
if (blockScope != null) {
var proc = blockScope.BlockFlowControl.Proc;
throw new EvalUnwinder(BlockReturnReason.Break, proc.Converter, proc.Kind, returnValue);
} else {
throw new LocalJumpError("unexpected break");
}
}