/// <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 VisitAssociativeArray(AssociativeArray value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, TypeConversion.ToNativeInteger(Snapshot, value)); break; default: result = Comparison.RightAlwaysGreater(OutSet, operation); if (result != null) { break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToNativeBoolean(Snapshot, value)); if (result != null) { break; } base.VisitAssociativeArray(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 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 VisitStringValue(StringValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value.Value); break; default: result = Comparison.LeftAlwaysGreater(OutSet, operation); if (result != null) { break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } base.VisitStringValue(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 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 VisitAnyResourceValue(AnyResourceValue 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 = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Bitwise operation with resource can give any integer break; } base.VisitAnyResourceValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value); break; default: result = Comparison.LeftAbstractBooleanCompare(OutSet, operation, value); if (result != null) { break; } result = ArithmeticOperation.LeftAbstractBooleanArithmetic(flow, operation, value); if (result != null) { break; } base.VisitIntervalFloatValue(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 VisitStringValue(StringValue value) { switch (operation) { case Operations.Mod: // Ommitted warning message that object cannot be converted to integer result = ModuloOperation.AbstractModulo(flow, value.Value); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Ommitted warning message that object cannot be converted to integer break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } base.VisitStringValue(value); break; } }
/// <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 VisitAnyArrayValue(AnyArrayValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow); break; default: result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { break; } if (ArithmeticOperation.IsArithmetic(operation)) { // TODO: This must be fatal error SetWarning("Unsupported operand type: Arithmetic of array and scalar type"); result = OutSet.AnyValue; break; } base.VisitAnyArrayValue(value); break; } }
/// <inheritdoc /> public override void VisitStringValue(StringValue 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.Value); break; default: result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } base.VisitStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAssociativeArray(AssociativeArray value) { switch (operation) { case Operations.Identical: result = OutSet.CreateBool(false); break; case Operations.NotIdentical: result = OutSet.CreateBool(true); break; case Operations.Mod: SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow); break; default: result = Comparison.LeftAlwaysGreater(OutSet, operation); if (result != null) { break; } if (ArithmeticOperation.IsArithmetic(operation)) { SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); // TODO: This must be fatal error SetWarning("Unsupported operand type: Arithmetic of array and object type"); result = OutSet.AnyValue; break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToNativeBoolean(Snapshot, value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { SetWarning("Object cannot be converted to integer by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitAssociativeArray(value); break; } }
/// <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 VisitObjectValue(ObjectValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: // TODO: Compare if two objects are the same instances of the same class result = OutSet.AnyBooleanValue; break; case Operations.Mod: SetWarning("Both objects cannot be converted to integers by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow); break; default: if (Comparison.IsOperationComparison(operation)) { // TODO: Two object instances are equal if they have the same attributes // and their values, and are instances of the same class. result = OutSet.AnyBooleanValue; break; } result = ArithmeticOperation.AbstractIntegerArithmetic(flow, operation); if (result != null) { SetWarning("Both objects cannot be converted to integers by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { SetWarning("Both objects cannot be converted to integers by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitObjectValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyResourceValue(AnyResourceValue 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.LeftAlwaysGreater(OutSet, operation); if (result != null) { break; } result = ArithmeticOperation.AbstractIntegerArithmetic(flow, operation); if (result != null) { // Arithmetic objects and resources is nonsence SetWarning("Object cannot be converted to integer by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Bitwise operation with resource can give any integer SetWarning("Object cannot be converted to integer by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitAnyResourceValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value); break; default: base.VisitIntervalFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue value) { switch (operation) { case Operations.Mod: result = ModuloOperation.AbstractModulo(flow); break; default: base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyStringValue(AnyStringValue value) { switch (operation) { case Operations.Mod: // Ommitted warnings messages that objects cannot be converted to integers result = ModuloOperation.AbstractModulo(flow); break; default: base.VisitAnyStringValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyObjectValue(AnyObjectValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: // It cannot be decided if they are identical or not. result = OutSet.AnyBooleanValue; break; case Operations.Mod: 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) { break; } result = ArithmeticOperation.AbstractIntegerArithmetic(flow, operation); if (result != null) { SetWarning("Both objects cannot be converted to integers by arithmetic operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { SetWarning("Both objects cannot be converted to integers by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitAnyObjectValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Mod: // Ommitted warning message that object cannot be converted to integer result = ModuloOperation.AbstractModulo(flow, value); break; default: base.VisitIntervalFloatValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyArrayValue(AnyArrayValue 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.RightAlwaysGreater(OutSet, operation); if (result != null) { break; } result = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(leftOperand)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { break; } if (ArithmeticOperation.IsArithmetic(operation)) { // TODO: This must be fatal error SetWarning("Unsupported operand type: Arithmetic of array and object type"); result = OutSet.AnyValue; break; } base.VisitAnyArrayValue(value); break; } }
/// <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 VisitAnyResourceValue(AnyResourceValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.Mod: result = ModuloOperation.AbstractModulo(flow); break; default: result = Comparison.AbstractCompare(OutSet, operation); if (result != null) { // Comapring of resource and integer makes no sence. break; } result = ArithmeticOperation.AbstractIntegerArithmetic(flow, operation); if (result != null) { // Arithmetic with resources is nonsence break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToBoolean(leftOperand), TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { // Bitwise operation with resource can give any integer break; } base.VisitAnyResourceValue(value); break; } }
/// <inheritdoc /> public override void VisitAnyObjectValue(AnyObjectValue value) { switch (operation) { case Operations.Identical: result = OutSet.CreateBool(false); break; case Operations.NotIdentical: result = OutSet.CreateBool(true); break; case Operations.Mod: SetWarning("Object cannot be converted to integer by modulo operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); result = ModuloOperation.AbstractModulo(flow); break; default: result = Comparison.RightAlwaysGreater(OutSet, operation); if (result != null) { break; } result = LogicalOperation.Logical(OutSet, operation, TypeConversion.ToNativeBoolean(Snapshot, leftOperand), TypeConversion.ToBoolean(value)); if (result != null) { break; } result = BitwiseOperation.Bitwise(OutSet, operation); if (result != null) { SetWarning("Object cannot be converted to integer by bitwise operation", AnalysisWarningCause.OBJECT_CONVERTED_TO_INTEGER); break; } base.VisitAnyObjectValue(value); break; } }
/// <inheritdoc /> public override void VisitIntervalFloatValue(FloatIntervalValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value); break; default: base.VisitIntervalFloatValue(value); break; } }
/// <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 VisitStringValue(StringValue value) { switch (operation) { case Operations.Identical: case Operations.NotIdentical: result = OutSet.AnyBooleanValue; break; case Operations.Mod: result = ModuloOperation.AbstractModulo(flow, value.Value); 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 = LogicalOperation.AbstractLogical(OutSet, operation, TypeConversion.ToBoolean(value.Value)); if (result != null) { break; } base.VisitStringValue(value); break; } }