Exemple #1
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Mod:
                SetWarning("Object cannot be converted to integer by modulo operation",
                           AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER);
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                result = Comparison.RightAbstractBooleanCompare(OutSet, operation,
                                                                TypeConversion.ToBoolean(leftOperand));
                if (result != null)
                {
                    break;
                }

                result = ArithmeticOperation.RightAbstractBooleanArithmetic(flow, operation);
                if (result != null)
                {
                    SetWarning("Object cannot be converted to integer by arithmetic operation",
                               AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER);
                    break;
                }

                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #2
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Identical:
                result = OutSet.CreateBool(false);
                break;

            case Operations.NotIdentical:
                result = OutSet.CreateBool(true);
                break;

            case Operations.Mod:
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                result = Comparison.RightAbstractBooleanCompare(OutSet, operation, leftOperand);
                if (result != null)
                {
                    break;
                }

                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #3
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Mod:
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                result = Comparison.RightAbstractBooleanCompare(OutSet, operation,
                                                                TypeConversion.ToBoolean(leftOperand));
                if (result != null)
                {
                    break;
                }

                result = ArithmeticOperation.RightAbstractBooleanArithmetic(flow, operation);
                if (result != null)
                {
                    break;
                }

                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #4
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Mod:
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #5
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Mod:
                // Ommitted warnings messages that objects cannot be converted to integers
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #6
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Equal:
            case Operations.NotEqual:
            case Operations.GreaterThanOrEqual:
            case Operations.LessThan:
            case Operations.Or:
            case Operations.Xor:
                result = value;
                break;

            case Operations.Add:
            case Operations.BitOr:
            case Operations.BitXor:
                result = TypeConversion.AnyBooleanToIntegerInterval(OutSet);
                break;

            case Operations.Sub:
                var booleanInterval = TypeConversion.AnyBooleanToIntegerInterval(OutSet);
                result = OutSet.CreateIntegerInterval(-booleanInterval.End, -booleanInterval.Start);
                break;

            case Operations.Mul:
                result = OutSet.CreateInt(0);
                break;

            case Operations.Div:
                SetWarning("Possible division by zero (converted from boolean false)",
                           AnalysisWarningCause.DIVISION_BY_ZERO);

                // Division or modulo by false returns false boolean value
                result = OutSet.AnyValue;
                break;

            case Operations.Mod:
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                base.VisitAnyBooleanValue(value);
                break;
            }
        }
Exemple #7
0
        /// <inheritdoc />
        public override void VisitAnyBooleanValue(AnyBooleanValue value)
        {
            switch (operation)
            {
            case Operations.Mod:
                result = ModuloOperation.ModuloByAnyBooleanValue(flow);
                break;

            default:
                result = Comparison.AbstractCompare(OutSet, operation);
                if (result != null)
                {
                    break;
                }

                base.VisitAnyBooleanValue(value);
                break;
            }
        }