using Mono.CompilerServices.SymbolWriter;
using System.Runtime.CompilerServices;
-#if NET_2_1
+#if MOBILE
using XmlElement = System.Object;
#else
using System.Xml;
return s + parameters.GetSignatureForDocumentation ();
}
- public virtual void PrepareEmit ()
+ public override void PrepareEmit ()
{
+ base.PrepareEmit ();
parameters.ResolveDefaultValues (this);
}
return ms;
}
+#if DEBUG
+ int counter = 100000;
+#endif
+
public MethodSpec MakeGenericMethod (IMemberContext context, params TypeSpec[] targs)
{
if (targs == null)
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;
}
}
- 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 ();
// 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) {
if (debug_builder == null)
return;
+#if !FULL_AOT_RUNTIME
var token = ConstructorBuilder.GetToken ();
int t = token.Token;
#if STATIC
#endif
debug_builder.DefineMethod (file, t);
+#endif
}
#region IMethodData Members
if (debug_builder == null)
return;
+#if !FULL_AOT_RUNTIME
var token = builder.GetToken ();
int t = token.Token;
#if STATIC
#endif
debug_builder.DefineMethod (file, t);
+#endif
}
}