Parcourir la source

Revert my unfinished patches that were accidentally committed

svn path=/trunk/mcs/; revision=41545
Duncan Mak il y a 21 ans
Parent
commit
b26d71e1fc
3 fichiers modifiés avec 12 ajouts et 55 suppressions
  1. 6 13
      mcs/mcs/convert.cs
  2. 0 8
      mcs/mcs/cs-tokenizer.cs
  3. 6 34
      mcs/mcs/expression.cs

+ 6 - 13
mcs/mcs/convert.cs

@@ -1036,27 +1036,20 @@ namespace Mono.CSharp {
 			if (method == null || count > 1)
 				return null;
 			
-			Expression original_source = source;
+			
 			//
 			// This will do the conversion to the best match that we
-			// found.  Now we need to perform an implicit standard conversion
+			// found.  Now we need to perform an implict standard conversion
 			// if the best match was not the type that we were requested
 			// by target.
 			//
 			if (look_for_explicit)
-				source = ExplicitConversionStandard (ec, original_source, most_specific_source, loc);
+				source = ExplicitConversionStandard (ec, source, most_specific_source, loc);
 			else
-				source = ImplicitConversionStandard (ec, original_source, most_specific_source, loc);
+				source = ImplicitConversionStandard (ec, source, most_specific_source, loc);
 
-			//
-			// If ImplicitConversionStandard comes up with nothing, try UserDefinedConversion 
-			// again, because a UserCast might be able to cast `original_source' into `most_specific_source'.
-			//
-			if (source == null) {
-				source = UserDefinedConversion (ec, original_source, most_specific_source, loc, false);
-				if (source == null)
-					return null;
-			}
+			if (source == null)
+				return null;
 
 			Expression e;
 			e =  new UserCast ((MethodInfo) method, source, loc);

+ 0 - 8
mcs/mcs/cs-tokenizer.cs

@@ -1947,14 +1947,11 @@ namespace Mono.CSharp
 					} else if (d == '*'){
 						getChar ();
 						bool docAppend = false;
-						bool expecting_end_of_comment = true;
-						
 						if (RootContext.Documentation != null && peekChar () == '*') {
 							getChar ();
 							// But when it is /**/, just do nothing.
 							if (peekChar () == '/') {
 								getChar ();
-								expecting_end_of_comment = false;
 								continue;
 							}
 							if (doc_state == XmlCommentState.Allowed)
@@ -1976,7 +1973,6 @@ namespace Mono.CSharp
 								getChar ();
 								col++;
 								comments_seen = true;
-								expecting_end_of_comment = false;
 								break;
 							}
 							if (docAppend)
@@ -2000,10 +1996,6 @@ namespace Mono.CSharp
 
 						if (docAppend)
 							update_formatted_doc_comment (current_comment_start);
-
-						if (expecting_end_of_comment)
-							Report.Error (1035, Location, "End-of-file found, '*/' expected");
-						
 						continue;
 					}
 					goto is_punct_label;

+ 6 - 34
mcs/mcs/expression.cs

@@ -2400,6 +2400,9 @@ namespace Mono.CSharp {
 
 					if (l == r)
 						return this;
+					
+					if (l.IsSubclassOf (r) || r.IsSubclassOf (l))
+						return this;
 
 					//
 					// Also, a standard conversion must exist from either one
@@ -2418,17 +2421,9 @@ namespace Mono.CSharp {
 						right = new EmptyCast (right, TypeManager.object_type);
 
 					//
-					// Report CS0252 / CS0253 if we have to invoke Object.op_Equality
-					// even when either l or r implements of op_Equality.
-					// 
-					if (!HasEqualityOperatorForType (l, r))
-						Warning_UnintendedReferenceComparison (loc, "right", r.FullName);
-					
-					else if (!HasEqualityOperatorForType (r, l))
-						Warning_UnintendedReferenceComparison (loc, "left", l.FullName);
-
-					if (l.IsSubclassOf (r) || r.IsSubclassOf (l))
-						return this;
+					// FIXME: CSC here catches errors cs254 and cs252
+					//
+					return this;
 				}
 
 				//
@@ -2698,29 +2693,6 @@ namespace Mono.CSharp {
 			return this;
 		}
 
-		// Checks whether or not 'container' has op_Equality that can handle 'comparison_type'.
-		public static bool HasEqualityOperatorForType (Type container, Type comparison_type)
-		{
-			// Can't call GetMethod here as there could be multiple impl. of op_Equality.
-			MethodInfo [] methods = container.GetMethods ();
-			foreach (MethodInfo m in methods) {
-				if (m.Name == "op_Equality") {
-					foreach (ParameterInfo param in m.GetParameters ()) {
-						if (param.ParameterType == comparison_type)
-							return true;
-					}
-				}
-			}
-			return false;
-		}
-
-		public static void Warning_UnintendedReferenceComparison (Location loc, string direction, string type_name)
-		{
-			Report.Warning ((direction == "left" ? 252 : 253), 2, loc,
-					"Possible unintended reference comparison; to get a value comparison, " +
-					"cast the " + direction + " hand side to type " + type_name + ".");
-		}
-
 		public override Expression DoResolve (EmitContext ec)
 		{
 			if ((oper == Operator.Subtraction) && (left is ParenthesizedExpression)) {