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


C# RubyScope.GetInnerMostBlockOrMethodScope方法代码示例

本文整理汇总了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"));
        }
开发者ID:TerabyteX,项目名称:main,代码行数:15,代码来源:RubyOps.FlowControl.cs

示例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);
        }
开发者ID:TerabyteX,项目名称:main,代码行数:22,代码来源:RubyOps.FlowControl.cs

示例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);
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:24,代码来源:RubyOps.FlowControl.cs

示例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");
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:16,代码来源:RubyOps.FlowControl.cs


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