2005-07-07 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / gmcs / generic.cs
index 68926e2391c22a1ceb5cc4ee66852af35eeb2cb8..5406444662418957cd26daa44c1cf61fbe3ca863 100644 (file)
@@ -1165,7 +1165,7 @@ namespace Mono.CSharp {
                                }
 
                                TypeExpr ct = new ConstructedType (ctype, new_args, loc);
-                               if (ct.ResolveAsTypeTerminal (ec) == null)
+                               if (ct.ResolveAsTypeStep (ec) == null)
                                        return false;
                                ctype = ct.Type;
                        }
@@ -1997,12 +1997,10 @@ namespace Mono.CSharp {
                        ArrayList list = new ArrayList ();
                        if (at.IsGenericInstance)
                                list.Add (at);
-                       else {
-                               for (Type bt = at.BaseType; bt != null; bt = bt.BaseType)
-                                       list.Add (bt);
+                       for (Type bt = at.BaseType; bt != null; bt = bt.BaseType)
+                               list.Add (bt);
 
-                               list.AddRange (TypeManager.GetInterfaces (at));
-                       }
+                       list.AddRange (TypeManager.GetInterfaces (at));
 
                        bool found_one = false;
 
@@ -2179,7 +2177,8 @@ namespace Mono.CSharp {
                                param_types [i] = pd.ParameterType (i);
 
                                Argument a = (Argument) arguments [i];
-                               if ((a.Expr is NullLiteral) || (a.Expr is MethodGroupExpr))
+                               if ((a.Expr is NullLiteral) || (a.Expr is MethodGroupExpr) ||
+                                   (a.Expr is AnonymousMethod))
                                        continue;
 
                                arg_types [i] = a.Type;
@@ -2950,15 +2949,26 @@ namespace Mono.CSharp {
                                if (unwrap != null) {
                                        unwrap.EmitCheck (ec);
                                        ig.Emit (OpCodes.Brfalse, is_null_label);
-                               }
 
-                               left.Emit (ec);
-                               ig.Emit (OpCodes.Br, end_label);
+                                       left.Emit (ec);
+                                       ig.Emit (OpCodes.Br, end_label);
 
-                               ig.MarkLabel (is_null_label);
-                               expr.Emit (ec);
+                                       ig.MarkLabel (is_null_label);
+                                       expr.Emit (ec);
 
-                               ig.MarkLabel (end_label);
+                                       ig.MarkLabel (end_label);
+                               } else {
+                                       left.Emit (ec);
+                                       ig.Emit (OpCodes.Dup);
+                                       ig.Emit (OpCodes.Brtrue, end_label);
+
+                                       ig.MarkLabel (is_null_label);
+
+                                       ig.Emit (OpCodes.Pop);
+                                       expr.Emit (ec);
+
+                                       ig.MarkLabel (end_label);
+                               }
                        }
                }