[Mono-devel-list] Re: [Mono-patches] r40971 - trunk/mcs/mcs

Raja R Harinath rharinath at novell.com
Mon Feb 21 04:47:25 EST 2005


Hi,

"Marek Safar <marek.safar at seznam.cz>" <marek at mono-cvs.ximian.com> writes:

[snip]
> @@ -316,7 +310,7 @@
>  			Type oldType = Type;
>  			
>  			// Sanity check.
> -			Type = CheckAttributeType (ec);
> +			Type = CheckAttributeType (ec); // TODO: I really don't think we need such expensive double check

Yep.  We can remove this.
  
> +		/// <summary>
> +		/// Resolves AttributeUsageAttribute for attribute class
> +		/// </summary>
> +		public AttributeUsageAttribute ResolveAttributeUsage (EmitContext ec)
> +		{
> +			if (OptAttributes == null)
> +				return Attribute.DefaultUsageAttribute;
> +
> +			Attribute a = OptAttributes.Search (TypeManager.attribute_usage_type, ec);
> +			if (a == null)
> +				return Attribute.DefaultUsageAttribute;
> +
> +			// Because our namespace model is so weird.
> +			// When GlobalAttribute is resolved and it has AttributeUsage attribute
> +			// we need to switch from global namespace to local
> +			DeclSpace old_ds = ec.DeclSpace;
> +			ec.DeclSpace = this;
> +			a.Resolve (ec);
> +			ec.DeclSpace = old_ds;
> +			return a.UsageAttribute;

Better as

       ResolveAttributeUsage ()
       {
         a.Resolve (type_resolve_ec);
       }

- Hari



More information about the Mono-devel-list mailing list