// class.cs: Class and Struct handlers
//
// Authors: Miguel de Icaza (miguel@gnu.org)
-// Martin Baulig (martin@gnome.org)
+// Martin Baulig (martin@ximian.com)
// Marek Safar (marek.safar@seznam.cz)
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001, 2002, 2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2004 Novell, Inc
//
//
// 2002-10-11 Miguel de Icaza <miguel@ximian.com>
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
+using System.Xml;
using Mono.CompilerServices.SymbolWriter;
protected Type[] ifaces;
protected Type ptype;
- // The parent member container and our member cache
- IMemberContainer parent_container;
+ // The parent member cache and our member cache
+ MemberCache parent_cache;
MemberCache member_cache;
public const string DefaultIndexerName = "Item";
int start, i, j;
if (Kind == Kind.Class){
- TypeExpr name = ResolveTypeExpr (
- (Expression) Bases [0], false, Location);
+ TypeExpr name = ResolveTypeExpr ((Expression) Bases [0], Location);
if (name == null){
error = true;
for (i = start, j = 0; i < count; i++, j++){
Expression name = (Expression) Bases [i];
- TypeExpr resolved = ResolveTypeExpr (name, false, Location);
+ TypeExpr resolved = ResolveTypeExpr (name, Location);
if (resolved == null) {
error = true;
return null;
return null;
}
- if (!parent.AsAccessible (this, ModFlags))
- Report.Error (60, Location,
- "Inconsistent accessibility: base class `" +
- parent.Name + "' is less accessible than class `" +
- Name + "'");
+ if (!parent.AsAccessible (this, ModFlags)) {
+ Report.SymbolRelatedToPreviousError (parent.Type);
+ Report.Error (60, Location, "Inconsistent accessibility: base class '{0}' is less accessible than class '{1}'",
+ TypeManager.CSharpName (parent.Type), GetSignatureForError ());
+ }
}
if (parent != null)
}
if (iface.IsClass) {
- if (parent != null){
- Report.Error (527, Location,
+ if (parent != null)
+ Report.Error (1721, Location,
+ "In Class `{0}', `{1}' is not an interface, and a base class has already been defined",
+ Name, iface.Name);
+ else {
+ Report.Error (1722, Location,
"In Class `{0}', `{1}' is not " +
- "an interface", Name, iface.Name);
- error = true;
- return null;
+ "an interface, a base class must be listed first", Name, iface.Name);
}
+ error = true;
+ return null;
}
for (int x = 0; x < i; x++) {
if (iface == t)
continue;
- if (!TypeManager.MayBecomeEqualGenericInstances (iface, t))
+ Type[] infered = new Type [CountTypeParameters];
+ if (!TypeManager.MayBecomeEqualGenericInstances (iface, t, infered, null))
continue;
Report.Error (
TypeManager.AddUserType (Name, TypeBuilder, this);
+ TypeExpr current_type = null;
+
if (IsGeneric) {
string[] param_names = new string [TypeParameters.Length];
for (int i = 0; i < TypeParameters.Length; i++)
for (int i = offset; i < gen_params.Length; i++)
CurrentTypeParameters [i - offset].DefineConstraints ();
- CurrentType = new ConstructedType (Name, TypeParameters, Location);
+ current_type = new ConstructedType (Name, TypeParameters, Location);
}
if (IsGeneric) {
}
}
- ConstructedType constructed = parent_type as ConstructedType;
- if ((constructed == null) && (parent_type != null))
- ptype = parent_type.ResolveType (ec);
- else
- ptype = null;
-
- if (constructed != null) {
- ptype = constructed.ResolveType (ec);
- if (ptype == null) {
+ if (parent_type != null) {
+ parent_type = parent_type.ResolveAsTypeTerminal (ec);
+ if (parent_type == null) {
error = true;
return null;
}
+
+ ptype = parent_type.Type;
}
if (!CheckRecursiveDefinition ()) {
}
}
+ if (current_type != null) {
+ current_type = current_type.ResolveAsTypeTerminal (ec);
+ if (current_type == null) {
+ error = true;
+ return null;
+ }
+
+ CurrentType = current_type.Type;
+ }
+
//
// Finish the setup for the EmitContext
//
return members_defined_ok;
}
- bool DoDefineMembers ()
+ protected virtual bool DoDefineMembers ()
{
//
// We need to be able to use the member cache while we are checking/defining
//
if (TypeBuilder.BaseType != null)
- parent_container = TypeManager.LookupMemberContainer (TypeBuilder.BaseType);
+ parent_cache = TypeManager.LookupMemberCache (TypeBuilder.BaseType);
- // TODO:
- //if (TypeBuilder.IsInterface) {
- // parent_container = TypeManager.LookupInterfaceContainer (base_inteface_types);
- //}
+ if (TypeBuilder.IsInterface)
+ parent_cache = TypeManager.LookupParentInterfacesCache (TypeBuilder);
if (IsTopLevel) {
if ((ModFlags & Modifiers.NEW) != 0)
DefineContainerMembers (delegates);
if (CurrentType != null) {
- GenericType = CurrentType.ResolveType (ec);
+ GenericType = CurrentType;
ec.ContainerType = GenericType;
}
public MemberInfo FindMemberWithSameName (string name, bool ignore_methods)
{
- return ParentContainer.MemberCache.FindMemberWithSameName (name, ignore_methods, null);
+ return ParentCache.FindMemberWithSameName (name, ignore_methods, null);
}
/// <summary>
type_bases = null;
OptAttributes = null;
ifaces = null;
- parent_container = null;
+ parent_cache = null;
member_cache = null;
}
}
}
+ public Constructor DefaultStaticConstructor {
+ get { return default_static_constructor; }
+ }
+
protected override bool VerifyClsCompliance (DeclSpace ds)
{
if (!base.VerifyClsCompliance (ds))
VerifyClsName ();
- // parent_container is null for System.Object
- if (parent_container != null && !AttributeTester.IsClsCompliant (parent_container.Type)) {
- Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (parent_container.Type));
+ if (IsGeneric) {
+ Report.Error (3024, Location, "'{0}': type parameters are not CLS-compliant",
+ GetSignatureForError ());
+ return false;
+ }
+
+ Type base_type = TypeBuilder.BaseType;
+ if (base_type != null && !AttributeTester.IsClsCompliant (base_type)) {
+ Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (base_type));
}
return true;
}
/// </summary>
void VerifyClsName ()
{
- Hashtable parent_members = parent_container == null ?
+ Hashtable parent_members = parent_cache == null ?
new Hashtable () :
- parent_container.MemberCache.GetPublicMembers ();
+ parent_cache.GetPublicMembers ();
Hashtable this_members = new Hashtable ();
foreach (DictionaryEntry entry in defined_names) {
return FindMembers (mt, new_bf, null, null);
}
- public virtual IMemberContainer ParentContainer {
+ //
+ // Generates xml doc comments (if any), and if required,
+ // handle warning report.
+ //
+ internal override void GenerateDocComment (DeclSpace ds)
+ {
+ DocUtil.GenerateTypeDocComment (this, ds);
+ }
+
+ public override string DocCommentHeader {
+ get { return "T:"; }
+ }
+
+ public virtual MemberCache ParentCache {
get {
- return parent_container;
+ return parent_cache;
}
}
public readonly TypeAttributes DefaultTypeAttributes;
static PartialContainer Create (NamespaceEntry ns, TypeContainer parent,
- MemberName name, int mod_flags, Kind kind,
+ MemberName member_name, int mod_flags, Kind kind,
Location loc)
{
PartialContainer pc;
- string full_name = name.GetName (true);
+ string full_name = member_name.GetName (true);
DeclSpace ds = (DeclSpace) RootContext.Tree.Decls [full_name];
if (ds != null) {
pc = ds as PartialContainer;
260, ds.Location, "Missing partial modifier " +
"on declaration of type `{0}'; another " +
"partial implementation of this type exists",
- name);
+ member_name.GetTypeName());
Report.LocationOfPreviousError (loc);
return null;
Report.Error (
261, loc, "Partial declarations of `{0}' " +
"must be all classes, all structs or " +
- "all interfaces", name);
+ "all interfaces", member_name.GetTypeName ());
return null;
}
Report.Error (
262, loc, "Partial declarations of `{0}' " +
"have conflicting accessibility modifiers",
- name);
+ member_name.GetTypeName ());
return null;
}
return pc;
}
- pc = new PartialContainer (ns, parent, name, mod_flags, kind, loc);
+ pc = new PartialContainer (ns, parent, member_name, mod_flags, kind, loc);
RootContext.Tree.RecordDecl (full_name, pc);
parent.AddType (pc);
pc.Register ();
interface_type, full, name, loc);
}
- public override IMemberContainer ParentContainer {
+ public override MemberCache ParentCache {
get {
- return PartialContainer.ParentContainer;
+ return PartialContainer.ParentCache;
}
}
}
return true;
// Is null for System.Object while compiling corlib and base interfaces
- if (Parent.ParentContainer == null) {
+ if (Parent.ParentCache == null) {
if ((RootContext.WarningLevel >= 4) && ((ModFlags & Modifiers.NEW) != 0)) {
Report.Warning (109, Location, "The member '{0}' does not hide an inherited member. The new keyword is not required", GetSignatureForError (Parent));
}
return false;
}
} else {
- if (parent_method.IsAbstract) {
+ if (parent_method.IsAbstract && !IsInterface) {
Report.SymbolRelatedToPreviousError (parent_method);
Report.Error (533, Location, "'{0}' hides inherited abstract member", GetSignatureForError (Parent));
return false;
MethodAttributes thisp = flags & MethodAttributes.MemberAccessMask;
MethodAttributes parentp = parent_method.Attributes & MethodAttributes.MemberAccessMask;
- //
- // special case for "protected internal"
- //
-
- if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){
- //
- // when overriding protected internal, the method can be declared
- // protected internal only within the same assembly
- //
-
- if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){
- if (Parent.TypeBuilder.Assembly != parent_method.DeclaringType.Assembly){
- //
- // assemblies differ - report an error
- //
-
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- } else if (thisp != parentp) {
- //
- // same assembly, but other attributes differ - report an error
- //
-
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- };
- } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) {
- //
- // if it's not "protected internal", it must be "protected"
- //
-
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- } else if (Parent.TypeBuilder.Assembly == parent_method.DeclaringType.Assembly) {
- //
- // protected within the same assembly - an error
- //
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) !=
- (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) {
- //
- // protected ok, but other attributes differ - report an error
- //
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- }
- } else {
- if (thisp != parentp){
- Error_CannotChangeAccessModifiers (Parent, parent_method, name);
- ok = false;
- }
+ if (!CheckAccessModifiers (thisp, parentp, parent_method)) {
+ Error_CannotChangeAccessModifiers (Parent, parent_method, name);
+ ok = false;
}
}
return ok;
}
+
+ protected bool CheckAccessModifiers (MethodAttributes thisp, MethodAttributes parentp, MethodInfo base_method)
+ {
+ if ((parentp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){
+ //
+ // when overriding protected internal, the method can be declared
+ // protected internal only within the same assembly
+ //
+ if ((thisp & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem){
+ if (Parent.TypeBuilder.Assembly != base_method.DeclaringType.Assembly){
+ //
+ // assemblies differ - report an error
+ //
+
+ return false;
+ } else if (thisp != parentp) {
+ //
+ // same assembly, but other attributes differ - report an error
+ //
+
+ return false;
+ };
+ } else if ((thisp & MethodAttributes.Family) != MethodAttributes.Family) {
+ //
+ // if it's not "protected internal", it must be "protected"
+ //
+
+ return false;
+ } else if (Parent.TypeBuilder.Assembly == base_method.DeclaringType.Assembly) {
+ //
+ // protected within the same assembly - an error
+ //
+ return false;
+ } else if ((thisp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem)) !=
+ (parentp & ~(MethodAttributes.Family | MethodAttributes.FamORAssem))) {
+ //
+ // protected ok, but other attributes differ - report an error
+ //
+ return false;
+ }
+ return true;
+ } else {
+ return (thisp == parentp);
+ }
+ }
+
void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method, string name)
{
//
}
if (!AttributeTester.IsClsCompliant (MemberType)) {
- Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant", GetSignatureForError ());
+ if ((this is Property) || (this is Indexer))
+ Report.Error (3003, Location, "Type of `{0}' is not CLS-compliant",
+ GetSignatureForError ());
+ else
+ Report.Error (3002, Location, "Return type of '{0}' is not CLS-compliant",
+ GetSignatureForError ());
}
AttributeTester.AreParametersCompliant (Parameters.FixedParameters, Location);
return true;
}
+ bool MayUnify (MethodCore first, MethodCore second)
+ {
+ int a_type_params = 0;
+ if (first.GenericMethod != null)
+ a_type_params = first.GenericMethod.CountTypeParameters;
+
+ int b_type_params = 0;
+ if (second.GenericMethod != null)
+ b_type_params = second.GenericMethod.CountTypeParameters;
+
+ if (a_type_params != b_type_params)
+ return false;
+
+ Type[] class_infered, method_infered;
+ if (Parent.CountTypeParameters > 0)
+ class_infered = new Type [Parent.CountTypeParameters];
+ else
+ class_infered = null;
+
+ if (a_type_params > 0)
+ method_infered = new Type [a_type_params];
+ else
+ method_infered = null;
+
+ return TypeManager.MayBecomeEqualGenericInstances (
+ first.ParameterTypes, second.ParameterTypes, class_infered, method_infered);
+ }
+
protected bool IsDuplicateImplementation (MethodCore method)
{
if ((method == this) ||
if (param_types.Length != ParameterTypes.Length)
return false;
- int type_params = 0;
- if (GenericMethod != null)
- type_params = GenericMethod.CountTypeParameters;
-
- int m_type_params = 0;
- if (method.GenericMethod != null)
- m_type_params = method.GenericMethod.CountTypeParameters;
-
- if (type_params != m_type_params)
- return false;
-
bool equal = true;
- bool may_unify;
-
- Type[] infered_types;
- if (type_params > 0)
- infered_types = new Type [type_params];
- else
- infered_types = null;
-
- may_unify = Invocation.InferTypeArguments (
- param_types, ParameterTypes, ref infered_types);
-
- if (!may_unify) {
- if (type_params > 0)
- infered_types = new Type [type_params];
- else
- infered_types = null;
-
- may_unify = Invocation.InferTypeArguments (
- ParameterTypes, param_types, ref infered_types);
- }
+ bool may_unify = MayUnify (this, method);
for (int i = 0; i < param_types.Length; i++) {
if (param_types [i] != ParameterTypes [i])
// TODO: make operator compatible with MethodCore to avoid this
if (this is Operator && method is Operator) {
if (MemberType != method.MemberType)
- equal = false;
+ equal = may_unify = false;
}
if (equal) {
Report.Error (408, Location,
"`{0}' cannot define overload members that " +
"may unify for some type parameter substitutions",
- Parent.Name);
+ Parent.MemberName);
return true;
}
return false;
}
+ //
+ // Returns a string that represents the signature for this
+ // member which should be used in XML documentation.
+ //
+ public override string GetDocCommentName (DeclSpace ds)
+ {
+ return DocUtil.GetMethodDocCommentName (this, ds);
+ }
+
+ //
+ // Raised (and passed an XmlElement that contains the comment)
+ // when GenerateDocComment is writing documentation expectedly.
+ //
+ // FIXME: with a few effort, it could be done with XmlReader,
+ // that means removal of DOM use.
+ //
+ internal override void OnGenerateDocComment (DeclSpace ds, XmlElement el)
+ {
+ DocUtil.OnMethodGenerateDocComment (this, ds, el);
+ }
+
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { return "M:"; }
+ }
+
protected override void VerifyObsoleteAttribute()
{
base.VerifyObsoleteAttribute ();
protected override MethodInfo FindOutParentMethod (TypeContainer container, ref Type parent_ret_type)
{
- MethodInfo mi = (MethodInfo) container.ParentContainer.MemberCache.FindMemberToOverride (
+ MethodInfo mi = (MethodInfo) container.ParentCache.FindMemberToOverride (
container.TypeBuilder, Name, ParameterTypes, false);
if (mi == null)
return false;
if (container.CurrentType != null)
- declaring_type = container.CurrentType.ResolveType (ec);
+ declaring_type = container.CurrentType;
else
declaring_type = container.TypeBuilder;
// Lookup Type, verify validity
bool old_unsafe = ec.InUnsafe;
ec.InUnsafe = InUnsafe;
- TypeExpr texpr = Type.ResolveAsTypeTerminal (ec, false);
+ TypeExpr texpr = Type.ResolveAsTypeTerminal (ec);
ec.InUnsafe = old_unsafe;
if (texpr == null)
return false;
- MemberType = texpr.ResolveType (ec);
- if (MemberType == null)
- return false;
+ MemberType = texpr.Type;
if ((Parent.ModFlags & Modifiers.SEALED) != 0){
if ((ModFlags & (Modifiers.VIRTUAL|Modifiers.ABSTRACT)) != 0){
"Inconsistent accessibility: indexer return type `" +
TypeManager.CSharpName (MemberType) + "' is less " +
"accessible than indexer `" + Name + "'");
- else if (this is Method) {
- if (((Method) this).IsOperator)
+ else if (this is MethodCore) {
+ if (this is Operator)
Report.Error (56, Location,
"Inconsistent accessibility: return type `" +
TypeManager.CSharpName (MemberType) + "' is less " +
"Inconsistent accessibility: return type `" +
TypeManager.CSharpName (MemberType) + "' is less " +
"accessible than method `" + Name + "'");
- } else
+ } else {
Report.Error (52, Location,
"Inconsistent accessibility: field type `" +
TypeManager.CSharpName (MemberType) + "' is less " +
"accessible than field `" + Name + "'");
+ }
return false;
}
if (IsExplicitImpl) {
Expression expr = ExplicitInterfaceName.GetTypeExpression (Location);
- TypeExpr iface_texpr = expr.ResolveAsTypeTerminal (ec, false);
+ TypeExpr iface_texpr = expr.ResolveAsTypeTerminal (ec);
if (iface_texpr == null)
return false;
- InterfaceType = iface_texpr.ResolveType (ec);
- if (InterfaceType == null)
- return false;
+ InterfaceType = iface_texpr.Type;
- if (InterfaceType.IsClass) {
- Report.Error (538, Location, "'{0}' in explicit interface declaration is not an interface", ExplicitInterfaceName);
+ if (!InterfaceType.IsInterface) {
+ Report.Error (538, Location, "'{0}' in explicit interface declaration is not an interface", TypeManager.CSharpName (InterfaceType));
return false;
}
[Flags]
public enum Status : byte {
ASSIGNED = 1,
- USED = 2
+ USED = 2,
+ HAS_OFFSET = 4 // Used by FieldMember.
}
static string[] attribute_targets = new string [] { "field" };
public abstract class FieldMember: FieldBase
{
- bool has_field_offset = false;
+
protected FieldMember (TypeContainer parent, Expression type, int mod,
int allowed_mod, MemberName name, object init, Attributes attrs, Location loc)
{
if (a.Type == TypeManager.field_offset_attribute_type)
{
- has_field_offset = true;
+ status |= Status.HAS_OFFSET;
if (!Parent.HasExplicitLayout) {
Report.Error (636, Location, "The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)");
bool old_unsafe = ec.InUnsafe;
ec.InUnsafe = InUnsafe;
- TypeExpr texpr = Type.ResolveAsTypeTerminal (ec, false);
+ TypeExpr texpr = Type.ResolveAsTypeTerminal (ec);
+ ec.InUnsafe = old_unsafe;
if (texpr == null)
return false;
- MemberType = texpr.ResolveType (ec);
- ec.InUnsafe = old_unsafe;
- if (MemberType == null)
- return false;
+ MemberType = texpr.Type;
if (!CheckBase ())
return false;
public override void Emit ()
{
- if (Parent.HasExplicitLayout && !has_field_offset && (ModFlags & Modifiers.STATIC) == 0) {
+ if (Parent.HasExplicitLayout && ((status & Status.HAS_OFFSET) == 0) && (ModFlags & Modifiers.STATIC) == 0) {
Report.Error (625, Location, "'{0}': Instance field types marked with StructLayout(LayoutKind.Explicit) must have a FieldOffset attribute.", GetSignatureForError ());
}
base.Emit ();
}
+
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { return "F:"; }
+ }
}
//
{
if (a.Type == TypeManager.cls_compliant_attribute_type || a.Type == TypeManager.obsolete_attribute_type ||
a.Type == TypeManager.conditional_attribute_type) {
- Report.Error (1667, a.Location, "'{0}' is not valid on property or event accessors. It is valid on '{1}' declarations only", TypeManager.CSharpName (a.Type), a.GetValidTargets ());
+ Report.Error (1667, a.Location, "'{0}' is not valid on property or event accessors. It is valid on {1} declarations only", TypeManager.CSharpName (a.Type), a.GetValidTargets ());
return;
}
public override bool Define()
{
- return false;
+ throw new NotSupportedException ();
}
public virtual void Emit (TypeContainer container)
}
}
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { throw new InvalidOperationException ("Unexpected attempt to get doc comment from " + this.GetType () + "."); }
+ }
+
protected override void VerifyObsoleteAttribute()
{
}
// TODO: rename to Resolve......
protected override MethodInfo FindOutParentMethod (TypeContainer container, ref Type parent_ret_type)
{
- PropertyInfo parent_property = container.ParentContainer.MemberCache.FindMemberToOverride (
+ PropertyInfo parent_property = container.ParentCache.FindMemberToOverride (
container.TypeBuilder, Name, ParameterTypes, true) as PropertyInfo;
if (parent_property == null)
MethodAttributes get_flags = Modifiers.MethodAttr (Get.ModFlags != 0 ? Get.ModFlags : ModFlags);
get_accessor_access = (get_accessor.Attributes & MethodAttributes.MemberAccessMask);
- if (!Get.IsDummy && (get_accessor_access) !=
- (get_flags & MethodAttributes.MemberAccessMask))
+ if (!Get.IsDummy && !CheckAccessModifiers (get_flags & MethodAttributes.MemberAccessMask, get_accessor_access, get_accessor))
Report.Error (507, Location, "'{0}' can't change the access modifiers when overriding inherited member '{1}'",
GetSignatureForError (), TypeManager.GetFullNameSignature (parent_property));
}
MethodAttributes set_flags = Modifiers.MethodAttr (Set.ModFlags != 0 ? Set.ModFlags : ModFlags);
set_accessor_access = (set_accessor.Attributes & MethodAttributes.MemberAccessMask);
- if (!Set.IsDummy & (set_accessor_access) !=
- (set_flags & MethodAttributes.MemberAccessMask))
+ if (!Set.IsDummy && !CheckAccessModifiers (set_flags & MethodAttributes.MemberAccessMask, set_accessor_access, set_accessor))
Report.Error (507, Location, "'{0}' can't change the access modifiers when overriding inherited member '{1}'",
GetSignatureForError (container), TypeManager.GetFullNameSignature (parent_property));
}
return attribute_targets;
}
}
+
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { return "P:"; }
+ }
}
public class Property : PropertyBase, IIteratorContainer {
{
Add = new AddDelegateMethod (this, add);
Remove = new RemoveDelegateMethod (this, remove);
+
+ // For this event syntax we don't report error CS0067
+ // because it is hard to do it.
+ SetAssigned ();
}
public override string[] ValidAttributeTargets {
public class EventField: Event {
static string[] attribute_targets = new string [] { "event", "field", "method" };
+ static string[] attribute_targets_interface = new string[] { "event", "method" };
public EventField (TypeContainer parent, Expression type, int mod_flags,
bool is_iface, MemberName name, Object init,
}
if (a.Target == AttributeTargets.Method) {
- AddBuilder.SetCustomAttribute (cb);
- RemoveBuilder.SetCustomAttribute (cb);
+ Add.ApplyAttributeBuilder (a, cb);
+ Remove.ApplyAttributeBuilder (a, cb);
return;
}
public override string[] ValidAttributeTargets {
get {
- return attribute_targets;
+ return IsInterface ? attribute_targets_interface : attribute_targets;
}
}
}
return TypeManager.GetFullNameSignature (EventBuilder);
}
+
+ //
+ // Represents header string for documentation comment.
+ //
+ public override string DocCommentHeader {
+ get { return "E:"; }
+ }
}
return false;
if (OptAttributes != null) {
- Attribute indexer_attr = OptAttributes.GetIndexerNameAttribute (ec);
+ Attribute indexer_attr = OptAttributes.Search (TypeManager.indexer_name_type, ec);
if (indexer_attr != null) {
+ // Remove the attribute from the list because it is not emitted
+ OptAttributes.Attrs.Remove (indexer_attr);
+
ShortName = indexer_attr.GetIndexerAttributeValue (ec);
if (IsExplicitImpl) {