public bool CheckAllowedCast(AllType OriginalType, AllType NewType, out AllType?OverAllType, bool Expression = false) { if (OriginalType == AllType.VOID || NewType == AllType.VOID) { _symbolTable.DeclarationCantBeTypeVoid(); } if (OriginalType == NewType) { OverAllType = OriginalType; return(true); } if (CheckDecimalIntCast(OriginalType, NewType, Expression)) { OverAllType = AllType.DECIMAL; return(true); } // Check if any of the types is a string, that the other is not a class if (OriginalType == AllType.STRING || NewType == AllType.STRING) { bool Original_IsNot_Class = (_symbolTable.IsClass(OriginalType)); bool NewType_IsNot_Class = (_symbolTable.IsClass(NewType)); if (Original_IsNot_Class || NewType_IsNot_Class) { _symbolTable.CannotCastClass(); OverAllType = null; return(false); } OverAllType = AllType.STRING; return(true); } _symbolTable.IlligalCast(); OverAllType = null; return(false); }