AST.Negative.GetExpr C# (CSharp) Метод

GetExpr() публичный Метод

public GetExpr ( ABT env ) : ABT.Expr
env ABT
Результат ABT.Expr
        public override ABT.Expr GetExpr(ABT.Env env) {
            ABT.Expr expr = this.Expr.GetExpr(env);

            if (!expr.Type.IsArith) {
                throw new InvalidOperationException("Expected arithmetic Type.");
            }

            if (expr.Type.IsIntegral) {
                expr = ABT.TypeCast.IntegralPromotion(expr).Item1;
            }

            if (expr.IsConstExpr) {
                switch (expr.Type.Kind) {
                    case ABT.ExprTypeKind.LONG:
                        return new ABT.ConstLong(-((ABT.ConstLong)expr).Value, env);

                    case ABT.ExprTypeKind.ULONG:
                        return new ABT.ConstLong(-(Int32)((ABT.ConstULong)expr).Value, env);

                    case ABT.ExprTypeKind.FLOAT:
                        return new ABT.ConstFloat(-((ABT.ConstFloat)expr).Value, env);

                    case ABT.ExprTypeKind.DOUBLE:
                        return new ABT.ConstDouble(-((ABT.ConstDouble)expr).Value, env);

                    default:
                        throw new InvalidOperationException();
                }
            }

            return new ABT.Negative(expr);
        }
    }