/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Mod: SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow, value); break; default: result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, value); if (result != null) { break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), value); if (result != null) { break; } base.VisitIntervalFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Identical: result = OutSet.CreateBool(false); break; case Operations.NotIdentical: result = OutSet.CreateBool(true); break; case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value); break; default: result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, value); if (result != null) { break; } base.VisitIntervalFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitStringValue(StringValue value) { result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { return; } int integerValue; double floatValue; bool isInteger; TypeConversion.TryConvertToNumber(value.Value, true, out integerValue, out floatValue, out isInteger); result = isInteger ? ArithmeticOperation.LeftAbstractArithmetic(flow, operation, integerValue) : ArithmeticOperation.LeftAbstractArithmetic(flow, operation, floatValue); if (result != null) { return; } base.VisitStringValue(value); }
/// <inheritdoc /> public override void VisitBooleanValue(BooleanValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.ModuloByBooleanValue(flow, value.Value); break; default: var leftBoolean = TypeConversion.ToBoolean(leftOperand); result = Comparison.Compare(OutSet, operation, leftBoolean, value.Value); if (result != null) { break; } result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, TypeConversion.ToInteger(value.Value)); if (result != null) { break; } result = LogicalOperation.Logical(OutSet, operation, leftBoolean, value.Value); if (result != null) { break; } base.VisitBooleanValue(value); break; } }
/// <inheritdoc /> public override void VisitFloatValue(FloatValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value.Value); break; default: result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, value.Value); if (result != null) { break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } base.VisitFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitBooleanValue(BooleanValue value) { result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, TypeConversion.ToInteger(value.Value)); if (result != null) { return; } base.VisitBooleanValue(value); }
/// <inheritdoc /> public override void VisitStringValue(StringValue value) { switch (operation) { case Operations.Mod: SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow, value.Value); break; default: if (Comparison.IsOperationComparison(operation)) { // TODO: The comparison of string with object depends upon whether the object has // the "__toString" magic method implemented. If so, the string comparison is // performed. Otherwise, the object is always greater than string. result = OutSet.AnyBooleanValue; break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } int integerValue; double floatValue; bool isInteger; TypeConversion.TryConvertToNumber(value.Value, true, out integerValue, out floatValue, out isInteger); result = isInteger ? ArithmeticOperation.LeftAbstractArithmetic(flow, operation, integerValue) : ArithmeticOperation.LeftAbstractArithmetic(flow, operation, floatValue); if (result != null) { SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitStringValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalIntegerValue(IntegerIntervalValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value); break; default: result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, value); if (result != null) { break; } base.VisitIntervalIntegerValue(value); break; } }
/// <inheritdoc /> public override void VisitIntegerValue(IntegerValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; default: result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, value.Value); if (result != null) { break; } base.VisitIntegerValue(value); break; } }
/// <inheritdoc /> public override void VisitStringValue(StringValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value.Value); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } int integerValue; double floatValue; bool isInteger; TypeConversion.TryConvertToNumber(value.Value, true, out integerValue, out floatValue, out isInteger); result = isInteger ? ArithmeticOperation.LeftAbstractArithmetic(flow, operation, integerValue) : ArithmeticOperation.LeftAbstractArithmetic(flow, operation, floatValue); if (result != null) { break; } base.VisitStringValue(value); break; } }
/// <inheritdoc /> public override void VisitBooleanValue(BooleanValue value) { switch (operation) { case Operations.Mod: SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.ModuloByBooleanValue(flow, value.Value); break; default: var leftBoolean = TypeConversion.ToBoolean(leftOperand); result = Comparison.Compare(OutSet, operation, leftBoolean, value.Value); if (result != null) { break; } result = ArithmeticOperation.LeftAbstractArithmetic(flow, operation, TypeConversion.ToInteger(value.Value)); if (result != null) { SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } result = LogicalOperation.Logical(OutSet, operation, leftBoolean, value.Value); if (result != null) { break; } base.VisitBooleanValue(value); break; } }