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


C# ByteCodeGenerator.Branch方法代码示例

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


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

示例1: Compile

        public Item Compile(ByteCodeGenerator generator)
        {
            Chain thenExit = null;

            var item = new ConditionCompiler(node.Condition).Compile(generator);
            var elseChain = item.JumpFalse();

            Item x = null;
            if (!item.IsFalse())
            {
                generator.ResolveChain(item.TrueJumps);

                x = new ExpressionCompiler(node.ThenExpression).Compile(generator).Load();

                thenExit = generator.Branch([email protected]);
            }
            if (elseChain != null)
            {
                generator.ResolveChain(elseChain);

                x = new ExpressionCompiler(node.ElseExpression).Compile(generator).Load();
            }
            generator.ResolveChain(thenExit);

            //var type = tb.Type.FindCommonType(fb.Type);
            var type = x.Type;

            return new StackItem(generator, type);
        }
开发者ID:will14smith,项目名称:JavaCompiler,代码行数:29,代码来源:ConditionalCompiler.cs

示例2: Compile

        public void Compile(ByteCodeGenerator generator)
        {
            var item = new ConditionCompiler(node.Condition).Compile(generator);
            var elseChain = item.JumpFalse();

            Chain thenExit = null;
            if (!item.IsFalse())
            {
                generator.ResolveChain(item.TrueJumps);

                generator.PushScope();

                new StatementCompiler(node.TrueBranch).Compile(generator);
                thenExit = generator.Branch([email protected]);

                generator.PopScope();
            }
            if (elseChain != null)
            {
                generator.ResolveChain(elseChain);

                if (node.FalseBranch != null)
                {
                    generator.PushScope();
                    new StatementCompiler(node.FalseBranch).Compile(generator);
                    generator.PopScope();
                }
            }

            generator.ResolveChain(thenExit);
        }
开发者ID:will14smith,项目名称:JavaCompiler,代码行数:31,代码来源:IfCompiler.cs

示例3: Compile

        public void Compile(ByteCodeGenerator generator)
        {
            var start = generator.EntryPoint();

            // Test Condition
            var item = new ConditionCompiler(node.Expression).Compile(generator);
            var loopDone = item.JumpFalse();

            generator.ResolveChain(item.TrueJumps);

            // Run Body
            generator.PushScope();

            new StatementCompiler(node.Statement).Compile(generator);
            generator.ResolveChain(generator.Branch([email protected]), start);

            generator.PopScope();

            // End
            generator.ResolveChain(loopDone);
        }
开发者ID:will14smith,项目名称:JavaCompiler,代码行数:21,代码来源:WhileCompiler.cs

示例4: Compile

        public void Compile(ByteCodeGenerator generator)
        {
            generator.PushScope();

            var start = generator.CurrentPC();
            new StatementCompiler(node.Initialiser).Compile(generator);

            var item = new ConditionCompiler(node.Condition).Compile(generator);
            var loopDone = item.JumpFalse();

            generator.ResolveChain(item.TrueJumps);

            new StatementCompiler(node.Body).Compile(generator);
            new StatementCompiler(node.Updater).Compile(generator);

            generator.ResolveChain(generator.Branch([email protected]), start);

            generator.PopScope();

            generator.ResolveChain(loopDone);
        }
开发者ID:will14smith,项目名称:JavaCompiler,代码行数:21,代码来源:ForCompiler.cs


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