public override ABT.Expr GetExpr(ABT.Env env) {
ABT.Expr expr = this.Expr.GetExpr(env);
if (!expr.Type.IsIntegral) {
throw new InvalidOperationException("Expected integral Type.");
}
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.ConstULong(~((ABT.ConstULong)expr).Value, env);
default:
throw new InvalidOperationException();
}
}
return new ABT.BitwiseNot(expr);
}
}