Author: martin
Date: 2005-08-31 12:18:02 -0400 (Wed, 31 Aug 2005)
New Revision: 49204

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/class.cs
   trunk/mcs/gmcs/codegen.cs
   trunk/mcs/gmcs/driver.cs
   trunk/mcs/gmcs/namespace.cs
   trunk/mcs/gmcs/typemanager.cs
Log:
**** Merged r47558-47694 from MCS ****

Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/ChangeLog    2005-08-31 16:18:02 UTC (rev 49204)
@@ -1,3 +1,28 @@
+2005-07-26  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix #75628.
+       * class.cs (Constructor.Emit): Reset block to null if the block
+       resolve fails.
+
+2005-07-25  Marek Safar  <[EMAIL PROTECTED]>
+
+       * class.cs (TypeContainer.VerifyMembers): Be compatible in warning 169.
+
+2005-07-25  Marek Safar  <[EMAIL PROTECTED]>
+
+       * class.cs (MethodData.Define): Check whether accessor implementing
+       interface is public.
+
+       * driver.cs (Driver.parse): Try to be smart and check for `MZ' header.
+
+2005-07-22  Marek Safar  <[EMAIL PROTECTED]>
+
+       Fix #57245
+       * namespace.cs (LookupType): Moved same type check to...
+       
+       * typemanager.cs (LookupTypeReflection): Don't allow to import more 
types
+       with the same name.
+
 2005-07-21  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * namespace.cs (NamespaceLookupType): Avoid a string allocation when we

Modified: trunk/mcs/gmcs/class.cs
===================================================================
--- trunk/mcs/gmcs/class.cs     2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/class.cs     2005-08-31 16:18:02 UTC (rev 49204)
@@ -2207,9 +2207,15 @@
                                                if (!f.IsUsed){
                                                        if ((f.caching_flags & 
Flags.IsAssigned) == 0)
                                                                Report.Warning 
(169, 3, f.Location, "The private field `{0}' is never used", 
f.GetSignatureForError ());
-                                                       else
-                                                               Report.Warning 
(414, 3, f.Location, "The private field `{0}' is assigned but its value is 
never used",
+                                                       else {
+#if NET_2_0
+                                                               const int 
error_code = 414;
+#else
+                                                               const int 
error_code = 169;
+#endif
+                                                               Report.Warning 
(error_code, 3, f.Location, "The private field `{0}' is assigned but its value 
is never used",
                                                                        
f.GetSignatureForError ());
+                                                       }
                                                        continue;
                                                }
                                                
@@ -4713,8 +4719,10 @@
                            ((ModFlags & Modifiers.STATIC) == 0) && 
(Initializer == null))
                                Block.AddThisVariable (Parent, Location);
 
-                       if (block != null)
-                               block.ResolveMeta (ec, ParameterInfo);
+                       if (block != null) {
+                               if (!block.ResolveMeta (ec, ParameterInfo))
+                                       block = null;
+                       }
 
                        if ((ModFlags & Modifiers.STATIC) == 0){
                                if (Parent.Kind == Kind.Class && Initializer == 
null)
@@ -4987,7 +4995,7 @@
                                                }
                                                return false;
                                        }
-                                       if (implementing.IsSpecialName && 
!((member is PropertyBase || member is EventProperty))) {
+                                       if (implementing.IsSpecialName && 
!(method is AbstractPropertyEventMethod)) {
                                                
Report.SymbolRelatedToPreviousError (implementing);
                                                Report.Error (683, 
method.Location, "`{0}' explicit method implementation cannot implement `{1}' 
because it is an accessor",
                                                        
member.GetSignatureForError (), TypeManager.CSharpSignature (implementing));
@@ -4996,11 +5004,23 @@
 
                                        method_name = TypeManager.GetFullName 
(member.InterfaceType) + "." + method_name;
                                } else {
-                                       if (implementing != null && method is 
AbstractPropertyEventMethod && !implementing.IsSpecialName) {
-                                               
Report.SymbolRelatedToPreviousError (implementing);
-                                               Report.Error (686, 
method.Location, "Accessor `{0}' cannot implement interface member `{1}' for 
type `{2}'. Use an explicit interface implementation",
-                                                       
method.GetSignatureForError (), TypeManager.CSharpSignature (implementing), 
container.GetSignatureForError ());
-                                               return false;
+                                       if (implementing != null) {
+                                               AbstractPropertyEventMethod 
prop_method = method as AbstractPropertyEventMethod;
+                                               if (prop_method != null) {
+                                                       if 
(!implementing.IsSpecialName) {
+                                                               
Report.SymbolRelatedToPreviousError (implementing);
+                                                               Report.Error 
(686, method.Location, "Accessor `{0}' cannot implement interface member `{1}' 
for type `{2}'. Use an explicit interface implementation",
+                                                                       
method.GetSignatureForError (), TypeManager.CSharpSignature (implementing), 
container.GetSignatureForError ());
+                                                               return false;
+                                                       }
+                                                       
PropertyBase.PropertyMethod pm = prop_method as PropertyBase.PropertyMethod;
+                                                       if (pm != null && 
pm.HasCustomAccessModifier && (pm.ModFlags & Modifiers.PUBLIC) == 0) {
+                                                               
Report.SymbolRelatedToPreviousError (implementing);
+                                                               Report.Error 
(277, method.Location, "Accessor `{0}' must be declared public to implement 
interface member `{1}'",
+                                                                       
method.GetSignatureForError (), TypeManager.CSharpSignature (implementing, 
true));
+                                                               return false;
+                                                       }
+                                               }
                                        }
                                }
                        }
@@ -5045,7 +5065,6 @@
                                //
                                if ((modifiers & Modifiers.STATIC) != 0){
                                        implementing = null;
-                                       Modifiers.Error_InvalidModifier 
(method.Location, "static");
                                }
                        }
                        

Modified: trunk/mcs/gmcs/codegen.cs
===================================================================
--- trunk/mcs/gmcs/codegen.cs   2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/codegen.cs   2005-08-31 16:18:02 UTC (rev 49204)
@@ -636,10 +636,10 @@
 
                                if (anonymous_method_host != null)
                                        current_flow_branching = 
FlowBranching.CreateBranching (
-                                                       
anonymous_method_host.CurrentBranching,
-                                                       
FlowBranching.BranchingType.Block, block, loc);
+                                               
anonymous_method_host.CurrentBranching,
+                                               
FlowBranching.BranchingType.Block, block, loc);
                                else 
-                                               current_flow_branching = 
block.TopLevelBranching;
+                                       current_flow_branching = 
block.TopLevelBranching;
 
                                if (!block.Resolve (this)) {
                                        current_flow_branching = null;

Modified: trunk/mcs/gmcs/driver.cs
===================================================================
--- trunk/mcs/gmcs/driver.cs    2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/driver.cs    2005-08-31 16:18:02 UTC (rev 49204)
@@ -182,7 +182,15 @@
                        }
 
                        SeekableStreamReader reader = new SeekableStreamReader 
(input, encoding);
-                               
+
+                       // Check 'MZ' header
+                       if (reader.Read () == 77 && reader.Read () == 90) {
+                               Report.Error (2015, "Source file `{0}' is a 
binary file and not a text file", file.Name);
+                               input.Close ();
+                               return;
+                       }
+
+                       reader.Position = 0;
                        parser = new CSharpParser (reader, file, defines);
                        parser.ErrorOutput = Report.Stderr;
                        try {

Modified: trunk/mcs/gmcs/namespace.cs
===================================================================
--- trunk/mcs/gmcs/namespace.cs 2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/namespace.cs 2005-08-31 16:18:02 UTC (rev 49204)
@@ -159,16 +159,9 @@
                                t = tdecl.TypeBuilder;
                        }
                        string lookup = t != null ? t.FullName : (fullname == 
"" ? name : fullname + "." + name);
-                       Type rt = TypeManager.LookupTypeReflection (lookup);
+                       Type rt = TypeManager.LookupTypeReflection (lookup, 
loc);
                        if (t == null)
                                t = rt;
-                       else if (rt != null && t != rt && 
RootContext.WarningLevel >= 2) {
-                               Report.SymbolRelatedToPreviousError (t);
-                               Report.SymbolRelatedToPreviousError (rt);
-                               Report.Warning (436, loc,
-                                       "Ignoring imported type `{0}' since the 
current assembly already has a declaration with the same name", 
-                                       rt.FullName);
-                       }
 
                        TypeExpr te = t == null ? null : new TypeExpression (t, 
Location.Null);
                        cached_types [name] = te;

Modified: trunk/mcs/gmcs/typemanager.cs
===================================================================
--- trunk/mcs/gmcs/typemanager.cs       2005-08-31 16:02:49 UTC (rev 49203)
+++ trunk/mcs/gmcs/typemanager.cs       2005-08-31 16:18:02 UTC (rev 49204)
@@ -635,31 +635,51 @@
                return (Type) ret;
        }
 
-       public static Type LookupTypeReflection (string name)
+       public static Type LookupTypeReflection (string name, Location loc)
        {
-               Type t;
+               Type found_type = null;
 
                foreach (Assembly a in assemblies) {
-                       t = a.GetType (name);
-                       if (t != null) {
-                               if (t.IsPointer)
-                                       throw new InternalErrorException ("Use 
GetPointerType() to get a pointer");
-                               TypeAttributes ta = t.Attributes & 
TypeAttributes.VisibilityMask;
-                               if (ta != TypeAttributes.NotPublic &&
-                                   ta != TypeAttributes.NestedPrivate &&
-                                   ta != TypeAttributes.NestedAssembly &&
-                                   ta != TypeAttributes.NestedFamANDAssem)
-                                       return t;
+                       Type t = a.GetType (name);
+                       if (t == null)
+                               continue;
+
+                       if (t.IsPointer)
+                               throw new InternalErrorException ("Use 
GetPointerType() to get a pointer");
+
+                       TypeAttributes ta = t.Attributes & 
TypeAttributes.VisibilityMask;
+                       if (ta != TypeAttributes.NotPublic && ta != 
TypeAttributes.NestedPrivate &&
+                               ta != TypeAttributes.NestedAssembly && ta != 
TypeAttributes.NestedFamANDAssem) {
+                               if (found_type == null) {
+                                       found_type = t;
+                                       continue;
+                               }
+
+                               Report.SymbolRelatedToPreviousError 
(found_type);
+                               Report.SymbolRelatedToPreviousError (t);
+                               Report.Error (433, loc, "The imported type 
`{0}' is defined multiple times", name);
+                               return found_type;
                        }
                }
 
                foreach (Module mb in modules) {
-                       t = mb.GetType (name);
-                       if (t != null) 
-                               return t;
+                       Type t = mb.GetType (name);
+                       if (t == null)
+                               continue;
+                       
+                       if (found_type == null) {
+                               found_type = t;
+                               continue;
+                       }
+
+                       Report.SymbolRelatedToPreviousError (t);
+                       Report.SymbolRelatedToPreviousError (found_type);
+                       Report.Warning (436, 2, loc, "Ignoring imported type 
`{0}' since the current assembly already has a declaration with the same name",
+                               TypeManager.CSharpName (t));
+                       return t;
                }
 
-               return null;
+               return found_type;
        }
 
        /// <summary>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to