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 (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);
}
}
}
p.Name = md_p.Name;
p.DefaultValue = md_p.DefaultValue;
if (md_p.OptAttributes != null) {
- if (p.OptAttributes == null) {
- p.OptAttributes = md_p.OptAttributes;
- } else {
- p.OptAttributes.Attrs.AddRange (md_p.OptAttributes.Attrs);
- }
+ Attributes.AttachFromPartial (p, md_p);
}
}
// 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
}
}
else if (OperatorType == OpType.Implicit)
Parent.MemberCache.CheckExistingMembersOverloads (this, GetMetadataName (OpType.Explicit), parameters);
- TypeSpec declaring_type = Parent.CurrentType;
+ TypeSpec declaring_type = Parent.PartialContainer.CurrentType;
TypeSpec return_type = MemberType;
TypeSpec first_arg_type = ParameterTypes [0];