Esempio n. 1
0
        public override void Generate(ModuleContext context)
        {
            context.BeginLoop();
            var beginLabel = new LabelExpression(context.NewUID(), debugInfo);

            beginLabel.Generate(context);
            var jumpBegin = new LuaLabel(context.vm, beginLabel.value, beginLabel.index);
            var endLabel  = new LabelExpression(context.NewUID(), debugInfo);
            var jumpEnd   = new LuaLabel(context.vm, endLabel.value, endLabel.index);

            moduleExp.Generate(context);
            context.Add(new ByteCode {
                opCode = ByteCode.OpCode.Jump, opArg = jumpBegin
            });
            endLabel.Generate(context);
            jumpEnd.index = endLabel.index;
            context.EndLoop(jumpEnd);
        }