示例#1
0
        public override Value Evaluate(Interpreter i)
        {
            Value CastedA = new Value(A, i);
            if (CastedA.Type != ValueType.Integer)
                CastedA.CastAsInteger();

            return new Value(~CastedA.Integer);
        }
示例#2
0
        public override Value Evaluate(Interpreter i)
        {
            Value CastedA = new Value(A, i);
            Value CastedB = new Value(B, i);
            if (CastedA.Type != ValueType.Integer)
                CastedA.CastAsInteger();
            if (CastedB.Type != ValueType.Integer)
                CastedB.CastAsInteger();

            return new Value((long)((int) CastedA.Integer >> (int) CastedB.Integer));
        }
示例#3
0
        public override Value Evaluate(Interpreter i)
        {
            Value CastedA = new Value(A, i);
            if (CastedA.Type == ValueType.Boolean)
                CastedA.CastAsInteger();

            switch (CastedA.Type)
            {
                case ValueType.Integer:
                    return new Value(-CastedA.Integer);

                case ValueType.Decimal:
                    return new Value(-CastedA.Decimal);
            }
            Debug.Assert( false );
            return CastedA;
        }
示例#4
0
        public override Value Evaluate(List<Operation> args, Interpreter i)
        {
            if (args.Count != 1)
                throw new BadArgumentsError(1, args.Count);

            Value argument = new Value(args[0], i);
            switch (argument.Type)
            {
                case ValueType.Boolean:
                    argument.CastAsInteger();
                    return new Value((decimal)F((double)argument.Integer));

                case ValueType.Integer:
                    return new Value((decimal)F((double)argument.Integer));

                case ValueType.Decimal:
                    return new Value((decimal)F((double)argument.Decimal));

                default:
                    return null;
            }
        }