本文整理汇总了C#中CodeGenContext.StoreInLocal方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.StoreInLocal方法的具体用法?C# CodeGenContext.StoreInLocal怎么用?C# CodeGenContext.StoreInLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenContext
的用法示例。
在下文中一共展示了CodeGenContext.StoreInLocal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenCode0
internal override void GenCode0(CodeGenContext context)
{
context.newLine(location);
recv.GenCode(context);
LOCAL recvLocal = context.StoreInLocal("recv", PrimitiveType.Object, recv.location);
// lhs.vid=(lhs.vid() op rhs)
new METHOD_CALL(recvLocal, vid + "=", new METHOD_CALL(new METHOD_CALL(recvLocal, vid, new ARGS(null, null, null, null, recv.location, true), null, recv.location), op, rhs, location), location).GenCode(context);
context.ReleaseLocal(recvLocal.local, true);
}
示例2: GenCode
internal void GenCode(CodeGenContext context, PERWAPI.CILLabel endLabel, int RescueTemp, int exception)
{
for (RESCUE_CLAUSE clause = this; clause != null; clause = clause.next)
{
PERWAPI.CILLabel nextClause = context.NewLabel();
PERWAPI.CILLabel thisClause = context.NewLabel();
context.ldc_i4(0);
LOCAL exceptionCaught = context.StoreInLocal("caught", PERWAPI.PrimitiveType.Boolean, this.location);
for (Node type = clause.types; type != null; type = type.nd_next)
{
PERWAPI.CILLabel label1 = context.NewLabel();
// Precompute each separately to avoid computing a list of types
type.GenCode0(context);
LOCAL tt = context.StoreInLocal("type", PERWAPI.PrimitiveType.Object, type.location);
new METHOD_CALL(tt, ID.intern(Tokens.tEQQ), new AST.LOCAL(exception, type.location), type.location).GenCode(context);
context.ReleaseLocal(tt.local, true);
context.call(Runtime.Eval.Test);
context.brfalse(label1);
context.PushTrue();
context.stloc(exceptionCaught.local);
context.CodeLabel(label1);
}
context.ldloc(exceptionCaught.local);
context.brtrue(thisClause);
context.ReleaseLocal(exceptionCaught.local, true);
context.br(nextClause);
context.CodeLabel(thisClause);
if (clause.var != null)
{
clause.var.Assign(context, new AST.LOCAL(exception, clause.var.location));
context.pop();
}
if (clause.body != null)
clause.body.GenCode(context);
else
context.ldnull();
if (context.Reachable())
context.stloc(RescueTemp);
// reset $!
//Eval.ruby_errinfo.value = null;
context.ldsfld(Runtime.Eval.ruby_errinfo);
context.ldnull();
context.stfld(Runtime.global_variable.value);
context.Goto(endLabel);
context.CodeLabel(nextClause);
}
}
示例3: GenCode0
internal override void GenCode0(CodeGenContext context)
{
PERWAPI.CILLabel endLabel = context.NewLabel();
Node clause;
if (target != null)
{
context.newLine(target.location);
target.GenCode(context);
LOCAL t = context.StoreInLocal("target", PrimitiveType.Object, location);
for (clause = body; clause != null && clause is WHEN; clause = clause.nd_next)
((WHEN)clause).GenCode(context, t, endLabel);
context.ReleaseLocal(t.local, true);
}
else
{
for (clause = body; clause != null && clause is WHEN; clause = clause.nd_next)
{
context.newLine(clause.location);
((WHEN)clause).GenCode(context, endLabel);
}
}
if (clause != null) /* assume else clause */
clause.GenCode(context);
else
context.ldnull();
context.CodeLabel(endLabel);
context.newEndPoint(location);
}