X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fmethod.cs;h=c2b993564e2b354b066ca651e60f816da3707d00;hb=45d90b20b7fb92adbeaf9a711cade5489ebeee42;hp=6033cf47de3f0cf54054dc676c1f8f3c63629d36;hpb=3360de9221d7e4012822eb572abb41339c707645;p=mono.git diff --git a/mcs/mcs/method.cs b/mcs/mcs/method.cs index 6033cf47de3..c2b993564e2 100644 --- a/mcs/mcs/method.cs +++ b/mcs/mcs/method.cs @@ -21,7 +21,7 @@ using System.Linq; using Mono.CompilerServices.SymbolWriter; using System.Runtime.CompilerServices; -#if NET_2_1 +#if MOBILE using XmlElement = System.Object; #else using System.Xml; @@ -165,8 +165,9 @@ namespace Mono.CSharp { return s + parameters.GetSignatureForDocumentation (); } - public virtual void PrepareEmit () + public override void PrepareEmit () { + base.PrepareEmit (); parameters.ResolveDefaultValues (this); } @@ -443,6 +444,10 @@ namespace Mono.CSharp { return ms; } +#if DEBUG + int counter = 100000; +#endif + public MethodSpec MakeGenericMethod (IMemberContext context, params TypeSpec[] targs) { if (targs == null) @@ -464,6 +469,10 @@ namespace Mono.CSharp { inflated.constraints = TypeParameterSpec.InflateConstraints (inflator, constraints ?? GenericDefinition.TypeParameters); inflated.state |= StateFlags.PendingMakeMethod; +#if DEBUG + inflated.ID += counter; + counter += 100000; +#endif // if (inflated.parent == null) // inflated.parent = parent; @@ -722,7 +731,12 @@ namespace Mono.CSharp { } } - if (type_expr != null) + // + // Optimization but it also covers cases where we cannot check + // constraints because method is captured into generated class + // and type parameters context is now different + // + if (type_expr != null && !IsCompilerGenerated) ConstraintChecker.Check (this, member_type, type_expr.Location); base.Emit (); @@ -1090,19 +1104,12 @@ namespace Mono.CSharp { } if (base_override.IsGeneric) { - ObsoleteAttribute oa; foreach (var base_tp in base_tparams) { - oa = base_tp.BaseType.GetAttributeObsolete (); - if (oa != null) { - AttributeTester.Report_ObsoleteMessage (oa, base_tp.BaseType.GetSignatureForError (), Location, Report); - } + base_tp.BaseType.CheckObsoleteness (this, Location); if (base_tp.InterfacesDefined != null) { foreach (var iface in base_tp.InterfacesDefined) { - oa = iface.GetAttributeObsolete (); - if (oa != null) { - AttributeTester.Report_ObsoleteMessage (oa, iface.GetSignatureForError (), Location, Report); - } + iface.CheckObsoleteness (this, Location); } } } @@ -1773,8 +1780,12 @@ namespace Mono.CSharp { // If we use a "this (...)" constructor initializer, then // do not emit field initializers, they are initialized in the other constructor // - if (!(Initializer is ConstructorThisInitializer)) + if (!(Initializer is ConstructorThisInitializer)) { + var errors = Compiler.Report.Errors; Parent.PartialContainer.ResolveFieldInitializers (bc); + if (errors != Compiler.Report.Errors) + return; + } if (!IsStatic) { if (Initializer == null && Parent.PartialContainer.Kind == MemberKind.Class) { @@ -1864,6 +1875,7 @@ namespace Mono.CSharp { if (debug_builder == null) return; +#if !FULL_AOT_RUNTIME var token = ConstructorBuilder.GetToken (); int t = token.Token; #if STATIC @@ -1872,6 +1884,7 @@ namespace Mono.CSharp { #endif debug_builder.DefineMethod (file, t); +#endif } #region IMethodData Members @@ -2194,6 +2207,7 @@ namespace Mono.CSharp { if (debug_builder == null) return; +#if !FULL_AOT_RUNTIME var token = builder.GetToken (); int t = token.Token; #if STATIC @@ -2202,6 +2216,7 @@ namespace Mono.CSharp { #endif debug_builder.DefineMethod (file, t); +#endif } }