Пример #1
0
        static void ff_emit_relational(EmitContext ec, AST ast, Label lbl)
        {
            ILGenerator ig = ec.ig;
            Relational  r  = ast as Relational;

            r.Emit(ec);

            OpCode opcode;

            switch (r.op)
            {
            case JSToken.LessThan:
                opcode = OpCodes.Blt;
                break;

            case JSToken.GreaterThan:
                opcode = OpCodes.Bgt;
                break;

            case JSToken.LessThanEqual:
                opcode = OpCodes.Ble;
                break;

            case JSToken.GreaterThanEqual:
                opcode = OpCodes.Bge;
                break;

            default:
                throw new Exception("unexpected token");
            }

            ig.Emit(OpCodes.Ldc_I4_0);
            ig.Emit(OpCodes.Conv_R8);
            ig.Emit(opcode, lbl);
        }
Пример #2
0
        static void ft_emit_relational(EmitContext ec, Relational re, Label lbl)
        {
            ILGenerator ig = ec.ig;

            re.Emit(ec);
            JSToken op = re.op;

            OpCode opcode;

            switch (op)
            {
            case JSToken.LessThan:
                opcode = OpCodes.Bge_Un;
                break;

            case JSToken.GreaterThan:
                opcode = OpCodes.Ble_Un;
                break;

            case JSToken.LessThanEqual:
                opcode = OpCodes.Bgt_Un;
                break;

            case JSToken.GreaterThanEqual:
                opcode = OpCodes.Blt_Un;
                break;

            default:
                Console.WriteLine(re.Location.LineNumber);
                throw new NotImplementedException();
            }

            ig.Emit(OpCodes.Ldc_I4_0);
            ig.Emit(OpCodes.Conv_R8);
            ig.Emit(opcode, lbl);
        }
Пример #3
0
        static void ft_emit_relational(EmitContext ec, Relational re, Label lbl)
        {
            ILGenerator ig = ec.ig;

            re.Emit (ec);
            JSToken op = re.op;

            OpCode opcode;

            switch (op) {
            case JSToken.LessThan:
                opcode = OpCodes.Bge_Un;
                break;

            case JSToken.GreaterThan:
                opcode = OpCodes.Ble_Un;
                break;

            case JSToken.LessThanEqual:
                opcode = OpCodes.Bgt_Un;
                break;

            case JSToken.GreaterThanEqual:
                opcode = OpCodes.Blt_Un;
                break;

            default:
                Console.WriteLine (re.Location.LineNumber);
                throw new NotImplementedException ();
            }

            ig.Emit (OpCodes.Ldc_I4_0);
            ig.Emit (OpCodes.Conv_R8);
            ig.Emit (opcode, lbl);
        }