예제 #1
0
        protected override void DoGenerate(CilEmitter emitter)
        {
            ILabel comparisonLabel = emitter.GenerateLabel();
            ILabel contentsLabel   = emitter.GenerateLabel();

            variable = emitter.EmitLocalVarDeclaration("STEPS_LOOP_VAR" + stepCountExpr.lexline + "_" + stepCountExpr.lexline, typeof(int));
            stepCountExpr.EmitRValue(emitter);
            variable.EmitAssignment();

            comparisonLabel.Emit();

            variable.EmitValue();
            emitter.EmitInt32(0);
            emitter.EmitComparison(">");

            after.EmitJumpIfFalse();
            contentsLabel.Emit();

            statement.Generate(emitter, contentsLabel, comparisonLabel);

            variable.EmitValue();
            emitter.EmitInt32(1);
            emitter.EmitBinaryOperator("-");
            variable.EmitAssignment();

            comparisonLabel.EmitJump();

            /*
             *
             * logicalExpression.jumping(0, after)
             *
             * create label
             *
             * emit label
             *
             * stmt.Gen(label, begin)
             *
             * emit goto begin
             *
             */
        }
예제 #2
0
 protected override void EmitOperator(CilEmitter emitter)
 {
     emitter.EmitComparison(comparisonOperator);
 }