2002-11-05 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 5 Nov 2002 23:30:01 +0000 (23:30 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 5 Nov 2002 23:30:01 +0000 (23:30 -0000)
* class.cs (Class.Emit): Report warning 67: event not used if the
warning level is beyond 3.

* ecore.cs (Expression.ConvertExplicit): Missed a check for expr
being a NullLiteral.

* cs-parser.jay: Fix, Gonzalo reverted the order of the rank
specifiers.

* class.cs (TypeContainer.GetClassBases): Cover a missing code
path that might fail if a type can not be resolved.

* expression.cs (Binary.Emit): Emit unsigned versions of the
operators.

* driver.cs: use error 5.

svn path=/trunk/mcs/; revision=8842

mcs/mcs/ChangeLog
mcs/mcs/class.cs
mcs/mcs/cs-parser.jay
mcs/mcs/driver.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/interface.cs

index 8c34fac31fd0d6256c5b26c1baaa9532d2b126ee..cdadcba4799f8f4aeb7687fefa2508e08c0a098d 100755 (executable)
@@ -1,3 +1,22 @@
+2002-11-05  Miguel de Icaza  <miguel@ximian.com>
+
+       * class.cs (Class.Emit): Report warning 67: event not used if the
+       warning level is beyond 3.
+
+       * ecore.cs (Expression.ConvertExplicit): Missed a check for expr
+       being a NullLiteral.
+
+       * cs-parser.jay: Fix, Gonzalo reverted the order of the rank
+       specifiers. 
+
+       * class.cs (TypeContainer.GetClassBases): Cover a missing code
+       path that might fail if a type can not be resolved.
+
+       * expression.cs (Binary.Emit): Emit unsigned versions of the
+       operators. 
+
+       * driver.cs: use error 5.
+       
 2002-11-02  Gonzalo Paniagua Javier <gonzalo@gnome-db.org>
 
        * cs-parser.jay: simplified a rule and 5 SR conflicts dissapeared.
index af5d3819b3e090759e0340ef6a032c536bf6417a..5ea142ae25e680b9d5befde34dae3807f85d4721 100755 (executable)
@@ -686,6 +686,9 @@ namespace Mono.CSharp {
                        for (i = start, j = 0; i < count; i++, j++){
                                Expression name = (Expression) bases [i];
                                Expression resolved = ResolveTypeExpr (name, false, Location);
+                               if (resolved == null)
+                                       return null;
+                               
                                bases [i] = resolved;
                                Type t = resolved.Type;
 
@@ -1455,31 +1458,40 @@ namespace Mono.CSharp {
                        //
                        // Check for internal or private fields that were never assigned
                        //
-                       if (fields != null && RootContext.WarningLevel >= 3) {
-                               foreach (Field f in fields) {
-                                       if ((f.ModFlags & Modifiers.PUBLIC) != 0)
-                                               continue;
-
-                                       if (f.status == 0){
+                       if (RootContext.WarningLevel >= 3) {
+                               if (fields != null){
+                                       foreach (Field f in fields) {
+                                               if ((f.ModFlags & Modifiers.PUBLIC) != 0)
+                                                       continue;
+                                               
+                                               if (f.status == 0){
+                                                       Report.Warning (
+                                                               169, f.Location, "Private field " +
+                                                               MakeName (f.Name) + " is never used");
+                                                       continue;
+                                               }
+                                               
+                                               //
+                                               // Only report 649 on level 4
+                                               //
+                                               if (RootContext.WarningLevel < 4)
+                                                       continue;
+                                               
+                                               if ((f.status & Field.Status.ASSIGNED) != 0)
+                                                       continue;
+                                               
                                                Report.Warning (
-                                                       169, f.Location, "Private field " +
-                                                       MakeName (f.Name) + " is never used");
-                                               continue;
+                                                       649, f.Location,
+                                                       "Field " + MakeName (f.Name) + " is never assigned " +
+                                                       " to and will always have its default value");
                                        }
+                               }
 
-                                       //
-                                       // Only report 649 on level 4
-                                       //
-                                       if (RootContext.WarningLevel < 4)
-                                               continue;
-
-                                       if ((f.status & Field.Status.ASSIGNED) != 0)
-                                               continue;
-
-                                       Report.Warning (
-                                               649, f.Location,
-                                               "Field " + MakeName (f.Name) + " is never assigned " +
-                                               " to and will always have its default value");
+                               if (events != null){
+                                       foreach (Event e in events){
+                                               if (e.status == 0)
+                                                       Report.Warning (67, "The event " + MakeName (e.Name) + " is never used");
+                                       }
                                }
                        }
                        
@@ -3748,7 +3760,9 @@ namespace Mono.CSharp {
                Type declaring_type, reflected_type, event_type;
                string name;
 
-               public MyEventBuilder (TypeBuilder type_builder, string name, EventAttributes event_attr, Type event_type)
+               Event my_event;
+
+               public MyEventBuilder (Event ev, TypeBuilder type_builder, string name, EventAttributes event_attr, Type event_type)
                {
                        MyBuilder = type_builder.DefineEvent (name, event_attr, event_type);
 
@@ -3760,6 +3774,7 @@ namespace Mono.CSharp {
                        
                        attributes = event_attr;
                        this.name = name;
+                       my_event = ev;
                        this.event_type = event_type;
                }
                
@@ -3858,6 +3873,12 @@ namespace Mono.CSharp {
                                return event_type;
                        }
                }
+               
+               public void SetUsed ()
+               {
+                       if (my_event != null)
+                               my_event.status = (FieldBase.Status.ASSIGNED | FieldBase.Status.USED);
+               }
        }
        
        public class Event : FieldBase {
@@ -3939,7 +3960,7 @@ namespace Mono.CSharp {
                        RemoveBuilder.DefineParameter (1, ParameterAttributes.None, "value");
 
                        if (!IsExplicitImpl){
-                               EventBuilder = new MyEventBuilder (
+                               EventBuilder = new MyEventBuilder (this,
                                        parent.TypeBuilder, Name, e_attr, MemberType);
                                        
                                if (Add == null && Remove == null) {
index d8410d27773c925733b53572991f22c7b0799274..7be2bc0e7909b128790e979d4bbebc609d43b716 100755 (executable)
@@ -2143,7 +2143,7 @@ opt_rank_specifier
 rank_specifiers
        : rank_specifier opt_rank_specifier
          {
-                 $$ = (string) $1 + (string) $2;
+                 $$ = (string) $2 + (string) $1;
          }
         ;
 
index 713ecdabc42f7d3ee4ab500a36fd8726005784a8..e3e5a2faafb6f799160d28576b56f9515d1133ce 100755 (executable)
@@ -626,7 +626,7 @@ namespace Mono.CSharp
                        case "--linkres":
                                if ((i + 1) >= args.Length){
                                        Usage ();
-                                       Console.WriteLine("Missing argument to --linkres"); 
+                                       Report.Error (5, "Missing argument to --linkres"); 
                                        Environment.Exit (1);
                                }
                                if (resources == null)
@@ -639,7 +639,7 @@ namespace Mono.CSharp
                        case "--res":
                                if ((i + 1) >= args.Length){
                                        Usage ();
-                                       Console.WriteLine("Missing argument to --resource"); 
+                                       Report.Error (5, "Missing argument to --resource"); 
                                        Environment.Exit (1);
                                }
                                if (embedded_resources == null)
@@ -738,14 +738,14 @@ namespace Mono.CSharp
 
                        case "--mcs-debug":
                                if ((i + 1) >= args.Length){
-                                       Console.WriteLine ("--mcs-debug requires an argument");
+                                       Report.Error (5, "--mcs-debug requires an argument");
                                        Environment.Exit (1);
                                }
 
                                try {
                                        Report.DebugFlags = Int32.Parse (args [++i]);
                                } catch {
-                                       Console.WriteLine ("Invalid argument to --mcs-debug");
+                                       Report.Error (5, "Invalid argument to --mcs-debug");
                                        Environment.Exit (1);
                                }
                                return true;
@@ -756,7 +756,7 @@ namespace Mono.CSharp
                                
                        case "--recurse":
                                if ((i + 1) >= args.Length){
-                                       Console.WriteLine ("--recurse requires an argument");
+                                       Report.Error (5, "--recurse requires an argument");
                                        Environment.Exit (1);
                                }
                                CompileFiles (args [++i], true); 
@@ -774,7 +774,7 @@ namespace Mono.CSharp
                                
                        case "--debug-args":
                                if ((i + 1) >= args.Length){
-                                       Console.WriteLine ("--debug-args requires an argument");
+                                       Report.Error (5, "--debug-args requires an argument");
                                        Environment.Exit (1);
                                }
                                char[] sep = { ',' };
@@ -875,7 +875,7 @@ namespace Mono.CSharp
                        case "/linkres":
                        case "/linkresource":
                                if (value == ""){
-                                       Console.WriteLine ("{0} requires an argument", arg);
+                                       Report.Error (5, arg + " requires an argument");
                                        Environment.Exit (1);
                                }
                                if (resources == null)
@@ -887,7 +887,7 @@ namespace Mono.CSharp
                        case "/res":
                        case "/resource":
                                if (value == ""){
-                                       Console.WriteLine ("{0} requires an argument", arg);
+                                       Report.Error (5, arg + " requires an argument");
                                        Environment.Exit (1);
                                }
                                if (embedded_resources == null)
@@ -898,7 +898,7 @@ namespace Mono.CSharp
                                
                        case "/recurse":
                                if (value == ""){
-                                       Console.WriteLine ("/recurse requires an argument");
+                                       Report.Error (5, "/recurse requires an argument");
                                        Environment.Exit (1);
                                }
                                CompileFiles (value, true); 
@@ -907,7 +907,7 @@ namespace Mono.CSharp
                        case "/r":
                        case "/reference": {
                                if (value == ""){
-                                       Console.WriteLine ("/reference requires an argument");
+                                       Report.Error (5, arg + " requires an argument");
                                        Environment.Exit (1);
                                }
 
@@ -922,7 +922,7 @@ namespace Mono.CSharp
                                string [] libdirs;
                                
                                if (value == ""){
-                                       Console.WriteLine ("/lib requires an argument");
+                                       Report.Error (5, "/lib requires an argument");
                                        Environment.Exit (1);
                                }
 
@@ -972,7 +972,7 @@ namespace Mono.CSharp
                                string [] warns;
 
                                if (value == ""){
-                                       Console.WriteLine ("/nowarn requires an argument");
+                                       Report.Error (5, "/nowarn requires an argument");
                                        Environment.Exit (1);
                                }
                                
@@ -1004,7 +1004,7 @@ namespace Mono.CSharp
                        case "/main":
                        case "/m":
                                if (value == ""){
-                                       Console.WriteLine ("/main requires an argument");                                       
+                                       Report.Error (5, arg + " requires an argument");                                        
                                        Environment.Exit (1);
                                }
                                RootContext.MainClass = value;
index 62674ead8b6906dcc4a05a6f3b8c5cdf02436d37..456dce88c741bdd0cc17575b37c6c51d08bd7bf0 100755 (executable)
@@ -2199,8 +2199,13 @@ namespace Mono.CSharp {
                        //
                        // Unboxing conversion.
                        //
-                       if (expr_type == TypeManager.object_type && target_type.IsValueType)
+                       if (expr_type == TypeManager.object_type && target_type.IsValueType){
+                               if (expr is NullLiteral){
+                                       Report.Error (37, "Cannot convert null to value type `" + TypeManager.CSharpName (expr_type) + "'");
+                                       return null;
+                               }
                                return new UnboxCast (expr, target_type);
+                       }
 
                        //
                        // Enum types
@@ -4362,9 +4367,11 @@ namespace Mono.CSharp {
                        if (add_accessor.IsStatic || remove_accessor.IsStatic)
                                is_static = true;
 
-                       if (EventInfo is MyEventBuilder)
-                               type = ((MyEventBuilder) EventInfo).EventType;
-                       else
+                       if (EventInfo is MyEventBuilder){
+                               MyEventBuilder eb = (MyEventBuilder) EventInfo;
+                               type = eb.EventType;
+                               eb.SetUsed ();
+                       } else
                                type = EventInfo.EventHandlerType;
                }
 
@@ -4410,6 +4417,7 @@ namespace Mono.CSharp {
                                        return null;
                        }
 
+                       
                        return this;
                }
 
index ac99ad916a3300ecf15d0e950caec3f4e6a9127a..7004640a1b64e5b82daf3c31eac9acd9d0f7752d 100755 (executable)
@@ -657,12 +657,19 @@ namespace Mono.CSharp {
        /// for the common case, and one with the extra fields for more complex
        /// classes (indexers require temporary access;  overloaded require method)
        ///
-       /// Maybe we should have classes PreIncrement, PostIncrement, PreDecrement,
-       /// PostDecrement, that way we could save the `Mode' byte as well.  
        /// </remarks>
        public class UnaryMutator : ExpressionStatement {
+               [Flags]
                public enum Mode : byte {
-                       PreIncrement, PreDecrement, PostIncrement, PostDecrement
+                       IsIncrement    = 0,
+                       IsDecrement    = 1,
+                       IsPre          = 0,
+                       IsPost         = 2,
+                       
+                       PreIncrement   = 0,
+                       PreDecrement   = IsDecrement,
+                       PostIncrement  = IsPost,
+                       PostDecrement  = IsPost | IsDecrement
                }
                
                Mode mode;
@@ -802,12 +809,15 @@ namespace Mono.CSharp {
                }
 
                //
-               // Loads the proper "1" into the stack based on the type
+               // Loads the proper "1" into the stack based on the type, then it emits the
+               // opcode for the operation requested
                //
-               static void LoadOne (ILGenerator ig, Type t)
+               void LoadOneAndEmitOp (EmitContext ec, Type t)
                {
+                       ILGenerator ig = ec.ig;
+                       
                        if (t == TypeManager.uint64_type || t == TypeManager.int64_type)
-                               ig.Emit (OpCodes.Ldc_I8, 1L);
+                               LongConstant.EmitLong (ig, 1);
                        else if (t == TypeManager.double_type)
                                ig.Emit (OpCodes.Ldc_R8, 1.0);
                        else if (t == TypeManager.float_type)
@@ -821,65 +831,58 @@ namespace Mono.CSharp {
                                        IntConstant.EmitInt (ig, n);
                        } else 
                                ig.Emit (OpCodes.Ldc_I4_1);
+
+                       //
+                       // Now emit the operation
+                       //
+                       if (ec.CheckState){
+                               if (t == TypeManager.int32_type ||
+                                   t == TypeManager.int64_type){
+                                       if ((mode & Mode.IsDecrement) != 0)
+                                               ig.Emit (OpCodes.Sub_Ovf);
+                                       else
+                                               ig.Emit (OpCodes.Add_Ovf);
+                               } else if (t == TypeManager.uint32_type ||
+                                          t == TypeManager.uint64_type){
+                                       if ((mode & Mode.IsDecrement) != 0)
+                                               ig.Emit (OpCodes.Sub_Ovf_Un);
+                                       else
+                                               ig.Emit (OpCodes.Add_Ovf_Un);
+                               } else {
+                                       if ((mode & Mode.IsDecrement) != 0)
+                                               ig.Emit (OpCodes.Sub_Ovf);
+                                       else
+                                               ig.Emit (OpCodes.Add_Ovf);
+                               }
+                       } else {
+                               if ((mode & Mode.IsDecrement) != 0)
+                                       ig.Emit (OpCodes.Sub);
+                               else
+                                       ig.Emit (OpCodes.Add);
+                       }
                }
 
-               
-               //
-               // FIXME: We need some way of avoiding the use of temp_storage
-               // for some types of storage (parameters, local variables,
-               // static fields) and single-dimension array access.
-               //
                void EmitCode (EmitContext ec, bool is_expr)
                {
                        ILGenerator ig = ec.ig;
                        IAssignMethod ia = (IAssignMethod) expr;
                        Type expr_type = expr.Type;
-                       
-                       if (temp_storage == null)
-                               temp_storage = new LocalTemporary (ec, expr_type);
 
                        ia.CacheTemporaries (ec);
-                       ig.Emit (OpCodes.Nop);
+
+                       if (temp_storage == null)
+                               temp_storage = new LocalTemporary (ec, expr_type);
+                       
                        switch (mode){
                        case Mode.PreIncrement:
                        case Mode.PreDecrement:
                                if (method == null){
                                        expr.Emit (ec);
-
-                                       LoadOne (ig, expr_type);
                                        
-                                       //
-                                       // Select the opcode based on the check state (then the type)
-                                       // and the actual operation
-                                       //
-                                       if (ec.CheckState){
-                                               if (expr_type == TypeManager.int32_type ||
-                                                   expr_type == TypeManager.int64_type){
-                                                       if (mode == Mode.PreDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf);
-                                               } else if (expr_type == TypeManager.uint32_type ||
-                                                          expr_type == TypeManager.uint64_type){
-                                                       if (mode == Mode.PreDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf_Un);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf_Un);
-                                               } else {
-                                                       if (mode == Mode.PreDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf);
-                                               }
-                                       } else {
-                                               if (mode == Mode.PreDecrement)
-                                                       ig.Emit (OpCodes.Sub);
-                                               else
-                                                       ig.Emit (OpCodes.Add);
-                                       }
+                                       LoadOneAndEmitOp (ec, expr_type);
                                } else 
                                        method.Emit (ec);
-
+                               
                                temp_storage.Store (ec);
                                ia.EmitAssign (ec, temp_storage);
                                if (is_expr)
@@ -896,34 +899,8 @@ namespace Mono.CSharp {
                                                expr.Emit (ec);
                                        else
                                                ig.Emit (OpCodes.Dup);
-
-                                       LoadOne (ig, expr_type);
                                        
-                                       if (ec.CheckState){
-                                               if (expr_type == TypeManager.int32_type ||
-                                                   expr_type == TypeManager.int64_type){
-                                                       if (mode == Mode.PostDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf);
-                                               } else if (expr_type == TypeManager.uint32_type ||
-                                                          expr_type == TypeManager.uint64_type){
-                                                       if (mode == Mode.PostDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf_Un);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf_Un);
-                                               } else {
-                                                       if (mode == Mode.PostDecrement)
-                                                               ig.Emit (OpCodes.Sub_Ovf);
-                                                       else
-                                                               ig.Emit (OpCodes.Add_Ovf);
-                                               }
-                                       } else {
-                                               if (mode == Mode.PostDecrement)
-                                                       ig.Emit (OpCodes.Sub);
-                                               else
-                                                       ig.Emit (OpCodes.Add);
-                                       }
+                                       LoadOneAndEmitOp (ec, expr_type);
                                } else {
                                        method.Emit (ec);
                                }
@@ -1014,7 +991,6 @@ namespace Mono.CSharp {
                                return;
                        case Action.AlwaysTrue:
                                ig.Emit (OpCodes.Pop);
-                               ig.Emit (OpCodes.Nop);
                                IntConstant.EmitInt (ig, 1);
                                return;
                        case Action.LeaveOnStack:
@@ -2482,12 +2458,13 @@ namespace Mono.CSharp {
                        left.Emit (ec);
                        right.Emit (ec);
 
+                       bool isUnsigned = is_unsigned (left.Type);
                        switch (oper){
                        case Operator.Multiply:
                                if (ec.CheckState){
                                        if (l == TypeManager.int32_type || l == TypeManager.int64_type)
                                                opcode = OpCodes.Mul_Ovf;
-                                       else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+                                       else if (isUnsigned)
                                                opcode = OpCodes.Mul_Ovf_Un;
                                        else
                                                opcode = OpCodes.Mul;
@@ -2497,14 +2474,14 @@ namespace Mono.CSharp {
                                break;
 
                        case Operator.Division:
-                               if (l == TypeManager.uint32_type || l == TypeManager.uint64_type)
+                               if (isUnsigned)
                                        opcode = OpCodes.Div_Un;
                                else
                                        opcode = OpCodes.Div;
                                break;
 
                        case Operator.Modulus:
-                               if (l == TypeManager.uint32_type || l == TypeManager.uint64_type)
+                               if (isUnsigned)
                                        opcode = OpCodes.Rem_Un;
                                else
                                        opcode = OpCodes.Rem;
@@ -2514,7 +2491,7 @@ namespace Mono.CSharp {
                                if (ec.CheckState){
                                        if (l == TypeManager.int32_type || l == TypeManager.int64_type)
                                                opcode = OpCodes.Add_Ovf;
-                                       else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+                                       else if (isUnsigned)
                                                opcode = OpCodes.Add_Ovf_Un;
                                        else
                                                opcode = OpCodes.Add;
@@ -2526,7 +2503,7 @@ namespace Mono.CSharp {
                                if (ec.CheckState){
                                        if (l == TypeManager.int32_type || l == TypeManager.int64_type)
                                                opcode = OpCodes.Sub_Ovf;
-                                       else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+                                       else if (isUnsigned)
                                                opcode = OpCodes.Sub_Ovf_Un;
                                        else
                                                opcode = OpCodes.Sub;
@@ -2535,7 +2512,7 @@ namespace Mono.CSharp {
                                break;
 
                        case Operator.RightShift:
-                               if (l == TypeManager.uint32_type || l == TypeManager.uint64_type)
+                               if (isUnsigned)
                                        opcode = OpCodes.Shr_Un;
                                else
                                        opcode = OpCodes.Shr;
@@ -2550,30 +2527,43 @@ namespace Mono.CSharp {
                                break;
 
                        case Operator.Inequality:
-                               ec.ig.Emit (OpCodes.Ceq);
-                               ec.ig.Emit (OpCodes.Ldc_I4_0);
+                               ig.Emit (OpCodes.Ceq);
+                               ig.Emit (OpCodes.Ldc_I4_0);
                                
                                opcode = OpCodes.Ceq;
                                break;
 
                        case Operator.LessThan:
-                               opcode = OpCodes.Clt;
+                               if (isUnsigned)
+                                       opcode = OpCodes.Clt_Un;
+                               else
+                                       opcode = OpCodes.Clt;
                                break;
 
                        case Operator.GreaterThan:
-                               opcode = OpCodes.Cgt;
+                               if (isUnsigned)
+                                       opcode = OpCodes.Cgt_Un;
+                               else
+                                       opcode = OpCodes.Cgt;
                                break;
 
                        case Operator.LessThanOrEqual:
-                               ec.ig.Emit (OpCodes.Cgt);
-                               ec.ig.Emit (OpCodes.Ldc_I4_0);
+                               if (isUnsigned)
+                                       ig.Emit (OpCodes.Cgt_Un);
+                               else
+                                       ig.Emit (OpCodes.Cgt);
+                               ig.Emit (OpCodes.Ldc_I4_0);
                                
                                opcode = OpCodes.Ceq;
                                break;
 
                        case Operator.GreaterThanOrEqual:
-                               ec.ig.Emit (OpCodes.Clt);
-                               ec.ig.Emit (OpCodes.Ldc_I4_1);
+                               if (isUnsigned)
+                                       ig.Emit (OpCodes.Clt_Un);
+                               else
+                                       ig.Emit (OpCodes.Clt);
+                               
+                               ig.Emit (OpCodes.Ldc_I4_1);
                                
                                opcode = OpCodes.Sub;
                                break;
@@ -3127,6 +3117,7 @@ namespace Mono.CSharp {
                                        ec.ig.Emit (OpCodes.Ldarga, arg_idx);
                        }
                }
+
        }
        
        /// <summary>
index 1d2dc2f5ccaa2ba089fa7d8fc57f6404706ae31d..995ec89666b9be5e82cd22bd2104c393537c6621 100755 (executable)
@@ -462,7 +462,7 @@ namespace Mono.CSharp {
                        Type [] parameters = new Type [1];
                        parameters [0] = event_type;
 
-                       eb = new MyEventBuilder (TypeBuilder, ie.Name,
+                       eb = new MyEventBuilder (null, TypeBuilder, ie.Name,
                                                 EventAttributes.None, event_type);
 
                        //