本文整理汇总了C#中CodeGenContext.isinst方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.isinst方法的具体用法?C# CodeGenContext.isinst怎么用?C# CodeGenContext.isinst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenContext
的用法示例。
在下文中一共展示了CodeGenContext.isinst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenCode0
internal override void GenCode0(CodeGenContext context)
{
int RescueTemp = context.CreateLocal("rescueTemp", PERWAPI.PrimitiveType.Object);
int ExceptionTemp = context.CreateLocal("exceptionTemp", PERWAPI.PrimitiveType.Object);
PERWAPI.CILLabel endLabel = context.NewLabel();
context.StartBlock(Clause.Try);
{
expr.GenCode(context);
if (context.Reachable())
{
context.stloc(RescueTemp);
context.Goto(endLabel);
}
}
PERWAPI.TryBlock tryBlock = context.EndTryBlock();
context.StartBlock(Clause.Catch);
{
PERWAPI.CILLabel stdErrLabel = context.NewLabel();
context.stloc(ExceptionTemp);
context.ldloc(ExceptionTemp);
context.ldfld(Runtime.RubyException.parent);
context.isinst(Runtime.StandardErrorRef);
context.brtrue(stdErrLabel);
context.ldloc(ExceptionTemp);
context.throwOp();
context.CodeLabel(stdErrLabel);
rescue.GenCode(context);
if (context.Reachable())
{
context.stloc(RescueTemp);
context.Goto(endLabel);
}
}
context.EndCatchBlock(Runtime.RubyExceptionRef, tryBlock);
context.CodeLabel(endLabel);
context.ldloc(RescueTemp);
context.ReleaseLocal(RescueTemp, true);
context.ReleaseLocal(ExceptionTemp, true);
}
示例2: GenRescue
internal void GenRescue(CodeGenContext context, PERWAPI.CILLabel endLabel, int RescueTemp, RESCUE_CLAUSE clauses)
{
// catch (System.Exception e) {
int e = context.StoreInTemp("e", Runtime.SystemExceptionRef, location);
//if (e is Ruby.ControlException)
PERWAPI.CILLabel else1 = context.NewLabel();
context.ldloc(e);
context.isinst(Runtime.ControlExceptionRef);
context.brfalse(else1);
// throw e;
context.rethrow();
context.CodeLabel(else1);
// Ruby.Exception exception;
int exception = context.CreateLocal("exception", Runtime.ExceptionRef);
//if (!(e is Ruby.RubyException))
PERWAPI.CILLabel else2 = context.NewLabel();
PERWAPI.CILLabel end = context.NewLabel();
context.ldloc(e);
context.isinst(Runtime.RubyExceptionRef);
context.brtrue(else2);
// exception = new Ruby.CLRException(frame, e);
context.ldloc(0);
context.ldloc(e);
context.newobj(Runtime.CLRException.ctor);
context.stloc(exception);
context.br(end);
//else
context.CodeLabel(else2);
// exception = (Ruby.RubyException)e.parent;
context.ldloc(e);
context.cast(Runtime.RubyExceptionRef);
context.ldfld(Runtime.RubyException.parent);
context.stloc(exception);
context.CodeLabel(end);
//Eval.ruby_errinfo.value = exception;
context.ldsfld(Runtime.Eval.ruby_errinfo);
context.ldloc(exception);
context.stfld(Runtime.global_variable.value);
if (clauses != null)
clauses.GenCode(context, endLabel, RescueTemp, exception);
context.rethrow();
context.ReleaseLocal(e, true);
context.ReleaseLocal(exception, true);
}