2002-05-20 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Mon, 20 May 2002 11:08:16 +0000 (11:08 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 20 May 2002 11:08:16 +0000 (11:08 -0000)
* expression.cs (Is): Bandaid until we fix properly Switch (see
bug #24985 for details).

* typemanager.cs (ImplementsInterface): The hashtable will contain
a null if there are no interfaces implemented.

2002-05-18  Miguel de Icaza  <miguel@ximian.com>

* cs-parser.jay (indexer_declarator): It is fine to have array
parameters

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

mcs/mcs/ChangeLog
mcs/mcs/class.cs
mcs/mcs/cs-parser.jay
mcs/mcs/expression.cs
mcs/mcs/typemanager.cs

index 157fa8495fa5b1ec46df450fd7b51bcaba8fd4fc..6b400a1e59121c8dde22dc200b5db5f638c6d749 100755 (executable)
@@ -1,3 +1,16 @@
+2002-05-20  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs (Is): Bandaid until we fix properly Switch (see
+       bug #24985 for details).
+
+       * typemanager.cs (ImplementsInterface): The hashtable will contain
+       a null if there are no interfaces implemented.
+
+2002-05-18  Miguel de Icaza  <miguel@ximian.com>
+
+       * cs-parser.jay (indexer_declarator): It is fine to have array
+       parameters
+
 2002-05-17  Miguel de Icaza  <miguel@ximian.com>
 
        * typemanager.cs: (RegisterBuilder): New function used to register
index 65f8e2b8f197a957357bafdfb868a4b74247d236..c060804a6747dea855cd364693cb842887c28f09 100755 (executable)
@@ -3728,8 +3728,25 @@ namespace Mono.CSharp {
 
                                Parameter [] fixed_parms = FormalParameters.FixedParameters;
 
+                               if (fixed_parms == null){
+                                       throw new Exception ("We currently do not support only array arguments in an indexer");
+                                       // BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG
+                                       // BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG
+                                       //
+                                       // Here is the problem: the `value' parameter has
+                                       // to come *after* the array parameter in the declaration
+                                       // like this:
+                                       // X (object [] x, Type value)
+                                       // .param [0]
+                                       //
+                                       // BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG
+                                       // BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG
+                                       
+                               }
+                               
                                Parameter [] tmp = new Parameter [fixed_parms.Length + 1];
 
+
                                fixed_parms.CopyTo (tmp, 0);
                                tmp [fixed_parms.Length] = new Parameter (
                                        Type, "value", Parameter.Modifier.NONE, null);
index fbae8e2f1f3789731c250e007017cd95d49f620e..3045abe5d95facb3c6c4964a6f5b0b70b39b2d0c 100755 (executable)
@@ -1045,17 +1045,22 @@ set_accessor_declaration
                if (parsing_indexer == false) {
                        args  = new Parameter [1];
                        args [0] = implicit_value_parameter;
+                       current_local_parameters = new Parameters (args, null, lexer.Location);
                } else {
-                       Parameter [] fp = indexer_parameters.FixedParameters;
-                       int count = fp.Length;
-
-                       args = new Parameter [count + 1];
-       
-                       fp.CopyTo (args, 0);
-                       args [count] = implicit_value_parameter;
+                       Parameter [] fpars = indexer_parameters.FixedParameters;
+
+                       if (fpars != null){
+                               int count = fpars.Length;
+
+                               args = new Parameter [count + 1];
+                               fpars.CopyTo (args, 0);
+                               args [count] = implicit_value_parameter;
+                       } else 
+                               args = null;
+                       current_local_parameters = new Parameters (
+                               args, indexer_parameters.ArrayParameter, lexer.Location);
                }
                
-               current_local_parameters = new Parameters (args, null, lexer.Location);
                lexer.PropertyParsing = false;
          }
          accessor_body
@@ -1580,7 +1585,7 @@ indexer_declaration
                parsing_indexer  = true;
                
                indexer_parameters = decl.param_list;
-               $$ = lexer.Location;
+               oob_stack.Push (lexer.Location);
          }
           accessor_declarations 
          {
@@ -1591,7 +1596,7 @@ indexer_declaration
          { 
                // The signature is computed from the signature of the indexer.  Look
                // at section 3.6 on the spec
-
+               Location loc = (Location) oob_stack.Pop ();
                Indexer indexer;
                IndexerDeclaration decl = (IndexerDeclaration) $3;
                Pair pair = (Pair) $6;
@@ -1599,7 +1604,7 @@ indexer_declaration
                Accessor set_block = (Accessor) pair.Second;
 
                indexer = new Indexer (decl.type, decl.interface_type, (int) $2, decl.param_list,
-                                      get_block, set_block, (Attributes) $1, (Location) $5);
+                                      get_block, set_block, (Attributes) $1, loc);
 
                // Note that there is no equivalent of CheckDef for this case
                // We shall handle this in semantic analysis
@@ -1617,7 +1622,7 @@ indexer_declarator
          {
                Parameters pars = (Parameters) $4;
 
-               if (pars.FixedParameters == null){
+               if (pars.FixedParameters == null && pars.ArrayParameter == null){
                        Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
                }
 
@@ -1627,7 +1632,7 @@ indexer_declarator
          {
                Parameters pars = (Parameters) $6;
 
-               if (pars.FixedParameters == null){
+               if (pars.FixedParameters == null && pars.ArrayParameter == null){
                        Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
                }
                $$ = new IndexerDeclaration ((string) $1, (string) $2, pars);
index 725afd72a1cfb78dced086669d69a56aec05e4d1..67881afd2287a7aa6a4ef25330b8a03156662bf5 100755 (executable)
@@ -997,6 +997,7 @@ namespace Mono.CSharp {
                                ig.Emit (OpCodes.Cgt_Un);
                                return;
                        }
+                       throw new Exception ("never reached");
                }
 
                public override Expression DoResolve (EmitContext ec)
index c2b39df8808adb4a90b19469bb16eeae3767923b..59fc022b35334e681b64501159b53df72cd8caa4 100755 (executable)
@@ -1016,9 +1016,11 @@ public class TypeManager {
                do {
                        interfaces = null;
                        
-                       if (t is TypeBuilder)
+                       if (t is TypeBuilder){
                                interfaces = (Type []) builder_to_ifaces [t];
-                       else
+                               if (interfaces == null)
+                                       return false;
+                       } else
                                interfaces = t.GetInterfaces ();
 
                        for (int i = interfaces.Length; i > 0; ){