/// <inheritdoc /> public override void VisitAnyObjectValue(AnyObjectValue value) { if (Comparison.IsOperationComparison(operation)) { // 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. Since we cannot // determine whether the abstract object has or has not the method, // we must return indeterminate boolean value. result = OutSet.AnyBooleanValue; return; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value)); if (result != null) { return; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); return; } base.VisitAnyObjectValue(value); }
/// <inheritdoc /> public override void VisitGenericIntervalValue <T>(IntervalValue <T> value) { switch (operation) { case Operations.Identical: result = OutSet.CreateBool(false); break; case Operations.NotIdentical: result = OutSet.CreateBool(true); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { break; } base.VisitGenericIntervalValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyScalarValue(AnyScalarValue value) { result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer return; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer // Ommitted error report that array is unsupported operand in arithmetic operation return; } result = LogicalOperation.AbstractLogical(OutSet, operation); if (result != null) { return; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer return; } base.VisitAnyScalarValue(value); }
/// <inheritdoc /> public override void VisitAnyValue(AnyValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.Mod: // Ommitted warning message that object cannot be converted to integer result = ModuloOperation.AbstractModulo(flow); break; default: result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer // Ommitted error report that array is unsupported operand in arithmetic operation break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } base.VisitAnyValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue 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); 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 = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // A string can be converted into floating point number too. break; } base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue value) { switch (operation) { case Operations.Equal: case Operations.NotEqual: case Operations.GreaterThanOrEqual: case Operations.LessThan: case Operations.Or: case Operations.Xor: result = OutSet.AnyBooleanValue; break; case Operations.Mod: result = ModuloOperation.AbstractModulo(flow); break; case Operations.BitOr: case Operations.BitXor: result = OutSet.AnyIntegerValue; break; default: result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { break; } base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue 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); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // A string can be converted into floating point number too. break; } base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitScalarValue(ScalarValue value) { result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { return; } base.VisitScalarValue(value); }
/// <inheritdoc /> public override void VisitGenericIntervalValue <T>(IntervalValue <T> value) { result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { return; } base.VisitGenericIntervalValue(value); }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue value) { result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // A string can be converted into floating point number too. return; } base.VisitAnyStringValue(value); }
/// <inheritdoc /> public override void VisitAnyResourceValue(AnyResourceValue value) { result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Arithmetic with resources is nonsence return; } base.VisitAnyResourceValue(value); }
/// <inheritdoc /> public override void VisitAnyValue(AnyValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.Mod: // Ommitted warning message that object cannot be converted to integer SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer // Ommitted error report that array is unsupported operand in arithmetic operation SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(leftOperand)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer SetWarning("Object cannot be converted to integer by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitAnyValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyObjectValue(AnyObjectValue value) { result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); return; } base.VisitAnyObjectValue(value); }
/// <inheritdoc /> public override void VisitAnyScalarValue(AnyScalarValue value) { result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { return; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { return; } base.VisitAnyScalarValue(value); }
/// <inheritdoc /> public override void VisitAnyResourceValue(AnyResourceValue value) { switch (operation) { case Operations.Mod: // Ommitted warning message that object cannot be converted to integer result = ModuloOperation.AbstractModulo(flow); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer // Ommitted error report that array is unsupported operand in arithmetic operation break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } base.VisitAnyResourceValue(value); break; } }
/// <inheritdoc /> public override void VisitGenericIntervalValue <T>(IntervalValue <T> value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Ommitted error report that array is unsupported operand in arithmetic operation break; } result = LogicalOperation.AbstractLogical(OutSet, operation, value); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } base.VisitGenericIntervalValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyFloatValue(AnyFloatValue value) { // When comparing, both operands are converted to boolean switch (operation) { case Operations.BitOr: case Operations.BitXor: result = OutSet.AnyIntegerValue; break; default: result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { break; } base.VisitAnyFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.BitAnd: case Operations.BitOr: case Operations.BitXor: // Bit operations are defined for every character, not for the entire string result = OutSet.AnyStringValue; break; case Operations.ShiftLeft: case Operations.ShiftRight: result = OutSet.AnyIntegerValue; break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { break; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { // Strings can be converted into floating point number too. break; } base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyFloatValue(AnyFloatValue value) { switch (operation) { case Operations.Identical: result = OutSet.CreateBool(false); break; case Operations.NotIdentical: result = OutSet.CreateBool(true); break; default: result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { return; } base.VisitAnyFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyResourceValue(AnyResourceValue value) { result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Comapring of resource and string makes no sence. return; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value)); if (result != null) { return; } result = ArithmeticOperation.AbstractFloatArithmetic(Snapshot, operation); if (result != null) { return; } base.VisitAnyResourceValue(value); }