Exemplo n.º 1
0
        private static void EmitUnaryBooleanExpression(UnaryBooleanExpression unaryBoolean, ILGenerator methodIL)
        {
            switch (unaryBoolean.OperatorKind)
            {
            case UnaryExpression.UnaryOperator.UnaryInversion:
                EmitExpression(unaryBoolean.Operand, methodIL);
                EmitInversion(methodIL);
                break;

            default:
                throw new Exception();
            }
        }
Exemplo n.º 2
0
        public static InnerType ResolveUnaryBooleanExpressionType(UnaryBooleanExpression unaryBooleanExpression)
        {
            InnerType OperandType = ResolveExpressionType(unaryBooleanExpression.Operand);

            //try to cast
            switch (unaryBooleanExpression.OperatorKind)
            {
            case UnaryArithExpression.UnaryOperator.UnaryInversion:
                if (OperandType is Boolean)
                {
                    return(OperandType);
                }
                ReportErrorInBooleanExpression(new SemanticErrorMessage($"Operator of logical inversion must be located before logical operand", unaryBooleanExpression.SourceContext));
                return(OperandType);

            default:
                return(new Undefined());
            }
        }
Exemplo n.º 3
0
 public static void TryToCastUnaryBooleanExpression(UnaryBooleanExpression unaryBoolean)
 {
     TryToCastExpression(unaryBoolean.Operand, new Undefined());
 }