示例#1
0
        private static OperatorResult UnaryOperatorFunc(OperatorOperands operands, UnaryArithmeticInstructionType operatorType)
        {
            if (operands.A.Type.ID != TypeID.Float && operands.A.Type.ID != TypeID.Integer && operands.A.Type.ID != TypeID.UInteger)
            {
                return(new OperatorResult(new CompileError(CompileErrorType.ExpectedNumericOperands, operands.A.Token)));
            }

            return(new OperatorResult(new UnaryArithmeticInstruction(operatorType, null, operands.A, operands.Function, operands.ByteCode, operands.Label), operands.A.Type, null));
        }
 public UnaryArithmeticInstruction(UnaryArithmeticInstructionType type, Variable res, Variable a, Function func, ByteCode byteCode, int label) : base(res, func, byteCode, label)
 {
     AType   = type;
     Operand = a;
 }