2003-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / mbas / class.cs
index 80c6eac30334df8f01a9a91426965831b1bc2388..cd16de718c72dae11491555750d80d7047a7d9fe 100644 (file)
@@ -198,13 +198,15 @@ namespace Mono.CSharp {
                        types.Add (c);
                        
                        // FIXME: Do we really need to explicitly add an empty default static constructor?
-                       if (c.default_static_constructor == null) 
+                       // Apparently we don't
+/*                     if (c.default_static_constructor == null) 
                        {
                                bool isModule = c is Mono.MonoBASIC.Module;
                                Constructor dc = new Constructor ("New", Parameters.EmptyReadOnlyParameters, null, c.Location);
                                dc.ModFlags = isModule ? Modifiers.PUBLIC | Modifiers.STATIC : Modifiers.PUBLIC;                                
                                c.AddConstructor (dc);          
-                       }
+                       } 
+*/
                        // --------------------------------------------------------------                               
                                
                        return AdditionResult.Success;
@@ -1970,7 +1972,7 @@ namespace Mono.CSharp {
                        Modifiers.ABSTRACT |
                        Modifiers.SEALED |
                        Modifiers.UNSAFE;
-
+               
                public Class (TypeContainer parent, string name, int mod, Attributes attrs, Location l)
                        : base (parent, name, l)
                {
@@ -2383,7 +2385,10 @@ namespace Mono.CSharp {
                        if (Name == "Main" &&
                            ((ModFlags & Modifiers.STATIC) != 0) && 
                            (RootContext.MainClass == null ||
-                            RootContext.MainClass == parent.TypeBuilder.FullName)){
+                            RootContext.MainClass == parent.TypeBuilder.FullName ||
+                            (RootContext.RootNamespace != null &&
+                                 RootContext.RootNamespace.Length > 0 &&
+                                 (RootContext.RootNamespace + "." + RootContext.MainClass) == parent.TypeBuilder.FullName))) {
                                 if (IsEntryPoint (MethodBuilder, ParameterInfo)) {
                                         if (RootContext.EntryPoint == null) {
                                                 RootContext.EntryPoint = MethodBuilder;
@@ -2464,17 +2469,17 @@ namespace Mono.CSharp {
                                loc);
                        
                        if (parent_constructor_group == null){
-                               Report.Error (1501, loc,
-                                      "Can not find a constructor for this argument list");
+                               string s = String.Format ("'{0}': Can not find a constructor for this argument list", t);
+                               Report.Error (1501, loc, s);
                                return false;
                        }
-                       
+
                        parent_constructor = (ConstructorInfo) Invocation.OverloadResolve (ec, 
                                (MethodGroupExpr) parent_constructor_group, argument_list, loc);
                        
                        if (parent_constructor == null){
-                               Report.Error (1501, loc,
-                                      "Can not find a constructor for this argument list");
+                               string s = String.Format ("'{0}': Can not find a constructor for this argument list", t);
+                               Report.Error (1501, loc, s);
                                return false;
                        }
                        
@@ -3638,7 +3643,7 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               public void Emit (TypeContainer tc)
+               public virtual void Emit (TypeContainer tc)
                {
                        //
                        // The PropertyBuilder can be null for explicit implementations, in that
@@ -3839,7 +3844,7 @@ namespace Mono.CSharp {
                        return true;
                }
 
-               public void Emit (TypeContainer tc)
+               public override void Emit (TypeContainer tc)
                {
                        base.Emit (tc);