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


C# Runtime.RuntimeFlowControl类代码示例

本文整理汇总了C#中IronRuby.Runtime.RuntimeFlowControl的典型用法代码示例。如果您正苦于以下问题:C# RuntimeFlowControl类的具体用法?C# RuntimeFlowControl怎么用?C# RuntimeFlowControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: EvalUnwinder

        internal EvalUnwinder(BlockReturnReason reason, RuntimeFlowControl targetFrame, ProcKind sourceProcKind, object returnValue)
            : base(returnValue) {

            Reason = reason;
            _targetFrame = targetFrame;
            _sourceProcKind = sourceProcKind;
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:7,代码来源:StackUnwinder.cs

示例2: CreateMainTopLevelScope

        public static RubyTopLevelScope/*!*/ CreateMainTopLevelScope(LocalsDictionary/*!*/ locals, Scope/*!*/ globalScope, LanguageContext/*!*/ language,
            out object self, out RuntimeFlowControl/*!*/ rfc, string dataPath, int dataOffset) {
            Assert.NotNull(locals, globalScope, language);

            RubyContext context = (RubyContext)language;
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, locals);
            scope.Initialize(new RuntimeFlowControl(), RubyMethodAttributes.PrivateInstance, rubyGlobalScope.MainObject);
            scope.SetDebugName("top-main");

            var objectClass = context.ObjectClass;
            objectClass.SetConstant("TOPLEVEL_BINDING", new Binding(scope));
            if (dataOffset >= 0) {
                RubyFile dataFile;
                if (context.DomainManager.Platform.FileExists(dataPath)) {
                    dataFile = new RubyFile(context, dataPath, RubyFileMode.RDONLY);
                    dataFile.Seek(dataOffset, SeekOrigin.Begin);
                } else {
                    dataFile = null;
                }

                objectClass.SetConstant("DATA", dataFile);
            }

            self = scope.SelfObject;
            rfc = scope.RuntimeFlowControl;

            return scope;
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:30,代码来源:RubyOps.cs

示例3: MethodRetry

 public static object MethodRetry(RuntimeFlowControl/*!*/ rfc, Proc proc) {
     if (proc != null) {
         return RetrySingleton;
     } else {
         throw new LocalJumpError("retry used out of rescue", rfc);
     }
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:7,代码来源:RuntimeFlowControl.cs

示例4: CreateMainTopLevelScope

        public static RubyTopLevelScope/*!*/ CreateMainTopLevelScope(LocalsDictionary/*!*/ locals, Scope/*!*/ globalScope, LanguageContext/*!*/ language,
            out object self, out RuntimeFlowControl/*!*/ rfc, string dataPath, int dataOffset) {
            Assert.NotNull(locals, globalScope, language);

            GlobalScopeExtension rubyGlobalScope = (GlobalScopeExtension)language.EnsureScopeExtension(globalScope);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, locals);
            scope.Initialize(new RuntimeFlowControl(), RubyMethodAttributes.PrivateInstance, rubyGlobalScope.MainObject);
            scope.SetDebugName(rubyGlobalScope.IsHosted ? "top-primary-hosted" : "top-primary");

            // define TOPLEVEL_BINDING constant:
            if (!rubyGlobalScope.IsHosted) {
                var objectClass = rubyGlobalScope.Context.ObjectClass;
                    
                objectClass.SetConstant("TOPLEVEL_BINDING", new Binding(scope));
                if (dataOffset >= 0) {
                    RubyFile dataFile;
                    if (File.Exists(dataPath)) {
                        dataFile = new RubyFile(rubyGlobalScope.Context, dataPath, RubyFileMode.RDONLY);
                        dataFile.Seek(dataOffset, SeekOrigin.Begin);
                    } else {
                        dataFile = null;
                    }

                    objectClass.SetConstant("DATA", dataFile);
                }
            }

            self = scope.SelfObject;
            rfc = scope.RuntimeFlowControl;

            return scope;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:33,代码来源:RubyOps.cs

示例5: CreateTopLevelScope

        public static RubyTopLevelScope/*!*/ CreateTopLevelScope(LocalsDictionary/*!*/ locals, Scope/*!*/ globalScope, LanguageContext/*!*/ language,
            out object self, out RuntimeFlowControl/*!*/ rfc) {

            RubyTopLevelScope scope = CreateTopLevelScopeInternal(locals, globalScope, language);
            self = scope.SelfObject;
            rfc = scope.RuntimeFlowControl;
            return scope;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:8,代码来源:RubyOps.cs

示例6: CreateModuleScope

        public static RubyModuleScope/*!*/ CreateModuleScope(LocalsDictionary/*!*/ locals, RubyScope/*!*/ parent,
            RuntimeFlowControl/*!*/ rfc, RubyModule/*!*/ module) {
            Assert.NotNull(locals, parent, rfc, module);

            RubyModuleScope scope = new RubyModuleScope(parent, module, false, rfc, module);
            scope.SetDebugName((module.IsClass ? "class" : "module") + " " + module.Name);

            scope.Frame = locals;
            return scope;
        }
开发者ID:teejayvanslyke,项目名称:ironruby,代码行数:10,代码来源:RubyOps.cs

示例7: CreateRfcForMethod

        public static RuntimeFlowControl/*!*/ CreateRfcForMethod(Proc proc) {
            RuntimeFlowControl result = new RuntimeFlowControl();
            result.IsActiveMethod = true;

            if (proc != null && proc.Kind == ProcKind.Block) {
                proc.Kind = ProcKind.Proc;
                proc.Converter = result;
            }

            return result;
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:11,代码来源:RuntimeFlowControl.cs

示例8: CreateTopLevelHostedScope

        public static RubyTopLevelScope/*!*/ CreateTopLevelHostedScope(LocalsDictionary/*!*/ locals, Scope/*!*/ globalScope, LanguageContext/*!*/ language,
            out object self, out RuntimeFlowControl/*!*/ rfc) {

            RubyContext context = (RubyContext)language;
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, true);

            // reuse existing top-level scope if available:
            RubyTopLevelScope scope = rubyGlobalScope.TopLocalScope;
            if (scope == null) {
                scope = new RubyTopLevelScope(rubyGlobalScope, null, locals);
                scope.Initialize(new RuntimeFlowControl(), RubyMethodAttributes.PrivateInstance, rubyGlobalScope.MainObject);
                scope.SetDebugName("top-level-hosted");
                rubyGlobalScope.TopLocalScope = scope;
            }

            self = scope.SelfObject;
            rfc = scope.RuntimeFlowControl;
            return scope;
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:19,代码来源:RubyOps.cs

示例9: CreateWrappedTopLevelScope

        public static RubyTopLevelScope/*!*/ CreateWrappedTopLevelScope(LocalsDictionary/*!*/ locals, Scope/*!*/ globalScope, LanguageContext/*!*/ language,
            out object self, out RuntimeFlowControl/*!*/ rfc) {

            RubyContext context = (RubyContext)language;

            RubyModule module = context.CreateModule(null, null, null, null, null, null, null);
            object mainObject = new Object();
            RubyClass mainSingleton = context.CreateMainSingleton(mainObject, new[] { module });

            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false);
            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, locals);
            scope.Initialize(new RuntimeFlowControl(), RubyMethodAttributes.PrivateInstance, rubyGlobalScope.MainObject);
            scope.SetDebugName("top-level-wrapped");
            scope.SelfObject = mainObject;
            scope.SetModule(module);

            self = scope.SelfObject;
            rfc = scope.RuntimeFlowControl;
            return scope;
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:20,代码来源:RubyOps.cs

示例10: MethodUnwinder

 internal MethodUnwinder(RuntimeFlowControl/*!*/ targetFrame, object returnValue)
     : base(returnValue) {
     Assert.NotNull(targetFrame);
     TargetFrame = targetFrame;
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:5,代码来源:StackUnwinder.cs

示例11: BlockReturnResult

 internal BlockReturnResult(RuntimeFlowControl/*!*/ targetFrame, object returnValue) {
     Assert.NotNull(targetFrame);
     TargetFrame = targetFrame;
     ReturnValue = returnValue;
 }
开发者ID:jschementi,项目名称:iron,代码行数:5,代码来源:BlockParam.cs

示例12: LeaveMethodFrame

 public static void LeaveMethodFrame(RuntimeFlowControl/*!*/ rfc) {
     rfc.IsActiveMethod = false;            
 }
开发者ID:Hank923,项目名称:ironruby,代码行数:3,代码来源:RuntimeFlowControl.cs

示例13: YieldBlockBreak

        private static void YieldBlockBreak(RuntimeFlowControl rfc, BlockParam/*!*/ ownerBlockFlowControl, BlockParam/*!*/ yieldedBlockFlowControl, object returnValue) {
            Assert.NotNull(ownerBlockFlowControl, yieldedBlockFlowControl);

            // target proc-converter:
            RuntimeFlowControl targetFrame = yieldedBlockFlowControl.TargetFrame;
            Debug.Assert(targetFrame != null);

            if (targetFrame.IsActiveMethod) {
                if (targetFrame == rfc) {
                    // The current primary super-frame is the proc-converter, however we are still in the block frame that needs to be unwound.
                    // Sets the owner's BFC to exit the current block (recursively up to the primary frame).
                    ownerBlockFlowControl.SetFlowControl(BlockReturnReason.Break, targetFrame, yieldedBlockFlowControl.SourceProcKind);
                    return;
                } else {
                    throw new MethodUnwinder(targetFrame, returnValue);
                }
            } else {
                throw new LocalJumpError("break from proc-closure");
            }
        }
开发者ID:Hank923,项目名称:ironruby,代码行数:20,代码来源:RuntimeFlowControl.cs

示例14: SetFlowControl

        internal void SetFlowControl(BlockReturnReason reason, RuntimeFlowControl targetFrame, ProcKind sourceProcKind) {
            Debug.Assert((reason == BlockReturnReason.Break) == (targetFrame != null));

            _returnReason = reason;
            _targetFrame = targetFrame;
            _sourceProcKind = sourceProcKind;
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:7,代码来源:BlockParam.cs

示例15: YieldMethodBreak

        // post-yield break ops:
        private static void YieldMethodBreak(RuntimeFlowControl rfc, BlockParam/*!*/ yieldedBlockFlowControl, object returnValue)
        {
            Assert.NotNull(yieldedBlockFlowControl);

            // target proc-converter:
            RuntimeFlowControl targetFrame = yieldedBlockFlowControl.TargetFrame;
            Debug.Assert(targetFrame != null);

            if (targetFrame.IsActiveMethod) {
                // optimize break to the current frame:
                if (targetFrame == rfc) {
                    return;
                } else {
                    throw new MethodUnwinder(targetFrame, returnValue);
                }
            } else {
                throw new LocalJumpError("break from proc-closure");
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:20,代码来源:RubyOps.FlowControl.cs


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