+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
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);
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
parsing_indexer = true;
indexer_parameters = decl.param_list;
- $$ = lexer.Location;
+ oob_stack.Push (lexer.Location);
}
accessor_declarations
{
{
// 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;
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
{
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");
}
{
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);