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


C# CodeGenContext.newEndPoint方法代码示例

本文整理汇总了C#中CodeGenContext.newEndPoint方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.newEndPoint方法的具体用法?C# CodeGenContext.newEndPoint怎么用?C# CodeGenContext.newEndPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeGenContext的用法示例。


在下文中一共展示了CodeGenContext.newEndPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenCode0

        internal override void GenCode0(CodeGenContext context)
        {
            PERWAPI.CILLabel finalLabel = context.NewLabel();

            int RescueTemp = context.CreateLocal("rescueTemp", PERWAPI.PrimitiveType.Object);
            context.ldnull();
            context.stloc(RescueTemp);

            if (ensure != null)
            {
                context.StartBlock(Clause.Try); // outer try block with finally

                context.StartBlock(Clause.Try); // inner try block with catch
            }

            GenInnerBlock(context, RescueTemp);

            if (ensure != null)
            {
                context.Goto(finalLabel);

                PERWAPI.TryBlock innerTry = context.EndTryBlock();

                context.StartBlock(Clause.Catch);
                GenRescue(context, null, 0, null);
                context.EndCatchBlock(Runtime.SystemExceptionRef, innerTry);

                PERWAPI.TryBlock outerTry = context.EndTryBlock();
                
                // Fixme: reset labels to prevent branches out of finally block.    
                context.StartBlock(Clause.Finally);
                ensure.GenCode(context);
                if (context.Reachable())
                    context.pop();
                context.endfinally();
                context.EndFinallyBlock(outerTry);

                context.CodeLabel(finalLabel);
                context.newEndPoint(location);
            }

            context.ldloc(RescueTemp);

            context.ReleaseLocal(RescueTemp, true);
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:45,代码来源:Exceptions.cs

示例2: AddScopeBody

        internal void AddScopeBody(CodeGenContext context)
        {
            returnTemp = context.CreateLocal("returnTemp", PrimitiveType.Object);

            context.labels = new Labels();
            context.labels.Redo = context.NewLabel();
            context.labels.Return = context.NewLabel();

            // try { ... }
            context.StartBlock(Clause.Try);
            {
                if (BEGIN != null)
                    BEGIN.GenCode(context);

                context.CodeLabel(context.labels.Redo);

                if (body != null)
                {
                    body.GenCode(context);

                    if (context.Reachable())
                        context.stloc(returnTemp);
                }

                context.Goto(context.labels.Return);
            }
            PERWAPI.TryBlock tryBlock = context.EndTryBlock();        

            CatchReturnException(context, tryBlock);

            // ReturnLabel:
            //    return returnTemp;
            context.CodeLabel(context.labels.Return);
            context.newEndPoint(location);
            if (context.Method.GetRetType() != PERWAPI.PrimitiveType.Void)
                context.ldloc(returnTemp);
            context.ret();

            context.ReleaseLocal(returnTemp, true);
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:40,代码来源:Scoping.cs

示例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);
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:33,代码来源:Stmts.cs


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