本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例10: MethodUnwinder
internal MethodUnwinder(RuntimeFlowControl/*!*/ targetFrame, object returnValue)
: base(returnValue) {
Assert.NotNull(targetFrame);
TargetFrame = targetFrame;
}
示例11: BlockReturnResult
internal BlockReturnResult(RuntimeFlowControl/*!*/ targetFrame, object returnValue) {
Assert.NotNull(targetFrame);
TargetFrame = targetFrame;
ReturnValue = returnValue;
}
示例12: LeaveMethodFrame
public static void LeaveMethodFrame(RuntimeFlowControl/*!*/ rfc) {
rfc.IsActiveMethod = false;
}
示例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");
}
}
示例14: SetFlowControl
internal void SetFlowControl(BlockReturnReason reason, RuntimeFlowControl targetFrame, ProcKind sourceProcKind) {
Debug.Assert((reason == BlockReturnReason.Break) == (targetFrame != null));
_returnReason = reason;
_targetFrame = targetFrame;
_sourceProcKind = sourceProcKind;
}
示例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");
}
}