[Mono-devel-list] Do we really need "related location" for CS0136?

Raja R Harinath rharinath at novell.com
Fri May 27 05:21:51 EDT 2005


Hi,

I had a few more comments about your patch.

Atsushi Eno <atsushi at ximian.com> writes:

> @@ -381,7 +376,7 @@
>  				for (int i = 0; i < FixedParameters.Length; i++){
>  					Parameter par = FixedParameters [i];
>  					
> -					signature += par.GetSignature (ec, loc);
> +					signature += par.GetSignature (ec, par.Location);
>  				}
>  			}

Since the information is already in Parameter, we can change the
signature of GetSignature to just take an EmitContext.

> @@ -496,7 +493,7 @@
>  				foreach (Parameter p in FixedParameters){
>  					Type t = null;
>  					
> -					if (p.Resolve (ec, loc))
> +					if (p.Resolve (ec, p.Location))
>  						t = p.ExternalType ();
>  					else
>  						failed = true;

Likewise, for Parameter.Resolve.

> @@ -507,7 +504,7 @@
>  			}
>  			
>  			if (extra > 0){
> -				if (ArrayParameter.Resolve (ec, loc))
> +				if (ArrayParameter.Resolve (ec, ArrayParameter.Location))
>  					types [i] = ArrayParameter.ExternalType ();
>  				else 

Likewise.

> Index: delegate.cs
> ===================================================================
> --- delegate.cs	(revision 45101)
> +++ delegate.cs	(working copy)
> @@ -146,10 +146,10 @@
>  			// FIXME: POSSIBLY make these static, as they are always the same
>  			Parameter [] fixed_pars = new Parameter [2];
>  			fixed_pars [0] = new Parameter (TypeManager.system_object_expr, "object",
> -							Parameter.Modifier.NONE, null);
> +							Parameter.Modifier.NONE, null, Location);
>  			fixed_pars [1] = new Parameter (TypeManager.system_intptr_expr, "method", 
> -							Parameter.Modifier.NONE, null);
> -			Parameters const_parameters = new Parameters (fixed_pars, null, Location);
> +							Parameter.Modifier.NONE, null, Location);
> +			Parameters const_parameters = new Parameters (fixed_pars, null);

Remove the FIXME comment above.

> Index: statement.cs
> ===================================================================
> --- statement.cs	(revision 45101)
> +++ statement.cs	(working copy)
> @@ -1574,7 +1574,7 @@
>  			int idx;
>  			Parameter p = Toplevel.Parameters.GetParameterByName (name, out idx);
>  			if (p != null) {
> -				Report.SymbolRelatedToPreviousError (Toplevel.Parameters.Location, name);
> +				Report.SymbolRelatedToPreviousError (p.Location, name);
>  				Report.Error (136, l, "'{0}' hides a method parameter", name);
>  				return null;

Cool.  Looks nice.

- Hari



More information about the Mono-devel-list mailing list