* class.cs (Indexer): Check return type as soon as possible.
* cs-parser.jay: Initialize implicit_value_parameter_type for interface
members too.
* ecore.cs (VarExpr.DoResolveLValue): Set eclass value.
* expression.cs (Invocation.Error_InvalidArguments): Show type only.
* parameter.cs (Parameter): Use expression type when it is available.
* support.cs (ReflectionParameters.ParameterDesc): Show an extension
method modifier for the first parameter only.
svn path=/trunk/mcs/; revision=81230
+2007-07-03 Marek Safar <marek.safar@gmail.com>
+
+ * class.cs (Indexer): Check return type as soon as possible.
+
+ * cs-parser.jay: Initialize implicit_value_parameter_type for interface
+ members too.
+
+ * ecore.cs (VarExpr.DoResolveLValue): Set eclass value.
+
+ * expression.cs (Invocation.Error_InvalidArguments): Show type only.
+
+ * parameter.cs (Parameter): Use expression type when it is available.
+
+ * support.cs (ReflectionParameters.ParameterDesc): Show an extension
+ method modifier for the first parameter only.
+
2007-06-24 Marek Safar <marek.safar@gmail.com>
A fix for bug #81938
is_iface ? AllowedInterfaceModifiers : AllowedModifiers,
is_iface, name, attrs, define_set_first)
{
+ if (type == TypeManager.system_void_expr)
+ Report.Error (620, name.Location, "An indexer return type cannot be `void'");
+
this.parameters = parameters;
if (get_block == null)
if (!DefineParameters (parameters))
return false;
- if (MemberType == TypeManager.void_type) {
- Report.Error (620, Location, "Indexers cannot have void type");
- return false;
- }
-
if (OptAttributes != null) {
Attribute indexer_attr = OptAttributes.Search (TypeManager.indexer_name_type);
if (indexer_attr != null) {
opt_new
type IDENTIFIER
OPEN_BRACE
- { lexer.PropertyParsing = true; }
+ {
+ lexer.PropertyParsing = true;
+ implicit_value_parameter_type = (Expression)$3;
+ }
accessor_declarations
{
has_get = has_set = false;
lexer.PropertyParsing = false;
+ implicit_value_parameter_type = null;
}
CLOSE_BRACE
{
}
| opt_attributes opt_new EVENT type IDENTIFIER OPEN_BRACE
{
+ implicit_value_parameter_type = (Expression) $4;
lexer.EventParsing = true;
}
event_accessor_declarations
{
lexer.EventParsing = false;
+ implicit_value_parameter_type = null;
}
CLOSE_BRACE {
Report.Error (69, (Location) $3, "Event in interface cannot have add or remove accessors");
interface_indexer_declaration
: opt_attributes opt_new type THIS
OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
- OPEN_BRACE
- { lexer.PropertyParsing = true; }
+ OPEN_BRACE
+ {
+ lexer.PropertyParsing = true;
+ implicit_value_parameter_type = (Expression)$3;
+ }
accessor_declarations
{
has_get = has_set = false;
lexer.PropertyParsing = false;
+ implicit_value_parameter_type = null;
}
CLOSE_BRACE
{
TypeManager.CSharpName (type));
return null;
}
-
+
+ eclass = ExprClass.Variable;
return this;
}
index, Parameter.GetModifierSignature (mod));
} else {
string p1 = Argument.FullDesc (a);
- string p2 = expected_par.ParameterDesc (idx);
+ string p2 = TypeManager.CSharpName (expected_par.ParameterType (idx));
if (p1 == p2) {
Report.ExtraInformation (loc, "(equally named types possibly from different assemblies in previous ");
Report.SymbolRelatedToPreviousError (a.Expr.Type);
Report.SymbolRelatedToPreviousError (expected_par.ParameterType (idx));
}
- Report.Error (1503, loc, "Argument {0}: Cannot convert from `{1}' to `{2}'", index, p1, p2);
+ Report.Error (1503, loc, "Argument {0}: Cannot convert type `{1}' to `{2}'", index, p1, p2);
}
}
#endif
public Parameter (Expression type, string name, Modifier mod, Attributes attrs, Location loc)
- : base (attrs)
+ : this (type.Type, name, mod, attrs, loc)
{
- Name = name;
- modFlags = mod;
+ if (type == TypeManager.system_void_expr)
+ Report.Error (1536, loc, "Invalid parameter type `void'");
+
TypeName = type;
- Location = loc;
}
public Parameter (Type type, string name, Modifier mod, Attributes attrs, Location loc)
// </summary>
public virtual bool Resolve (IResolveContext ec)
{
+ // HACK: to resolve attributes correctly
+ this.resolve_context = ec;
+
if (parameter_type != null)
return true;
- this.resolve_context = ec;
-
TypeExpr texpr = TypeName.ResolveAsTypeTerminal (ec, false);
if (texpr == null)
return false;
return false;
}
- if (parameter_type == TypeManager.void_type){
- Report.Error (1536, Location, "Invalid parameter type 'void'");
- return false;
- }
-
if ((modFlags & Parameter.Modifier.ISBYREF) != 0){
if (parameter_type == TypeManager.typed_reference_type ||
parameter_type == TypeManager.arg_iterator_type){
public Parameter Clone ()
{
- Parameter p = new Parameter (TypeName, Name, ModFlags, attributes, Location);
- p.parameter_type = parameter_type;
+ Parameter p = new Parameter (parameter_type, Name, ModFlags, attributes, Location);
p.IsTypeParameter = IsTypeParameter;
return p;
if (params_idx == pos)
sb.Append ("params ");
- if (ExtensionMethodType != null)
+ if (pos == 0 && ExtensionMethodType != null)
sb.Append ("this ");
sb.Append (TypeManager.CSharpName (partype).Replace ("&", ""));