// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
+// (C) 2004 Novell, Inc
//
// TODO: Move the method verification stuff from the class.cs and interface.cs here
//
using System.Globalization;
using System.Reflection.Emit;
using System.Reflection;
+using System.Xml;
namespace Mono.CSharp {
}
}
- public readonly MemberName MemberName;
+ // Is not readonly because of IndexerName attribute
+ public MemberName MemberName;
/// <summary>
/// Modifier flags that the user specified in the source code
/// </summary>
public readonly Location Location;
+ /// <summary>
+ /// XML documentation comment
+ /// </summary>
+ public string DocComment;
+
+ /// <summary>
+ /// Represents header string for documentation comment
+ /// for each member types.
+ /// </summary>
+ public abstract string DocCommentHeader { get; }
+
[Flags]
public enum Flags {
Obsolete_Undetected = 1, // Obsolete attribute has not been detected yet
/// <summary>
/// Returns true when MemberCore is exposed from assembly.
/// </summary>
- protected bool IsExposedFromAssembly (DeclSpace ds)
+ public bool IsExposedFromAssembly (DeclSpace ds)
{
if ((ModFlags & (Modifiers.PUBLIC | Modifiers.PROTECTED)) == 0)
return false;
bool GetClsCompliantAttributeValue (DeclSpace ds)
{
if (OptAttributes != null) {
- Attribute cls_attribute = OptAttributes.GetClsCompliantAttribute (ds.EmitContext);
+ Attribute cls_attribute = OptAttributes.Search (
+ TypeManager.cls_compliant_attribute_type, ds.EmitContext);
if (cls_attribute != null) {
caching_flags |= Flags.HasClsCompliantAttribute;
return cls_attribute.GetClsCompliantAttributeValue (ds);
protected abstract void VerifyObsoleteAttribute ();
+ //
+ // Raised (and passed an XmlElement that contains the comment)
+ // when GenerateDocComment is writing documentation expectedly.
+ //
+ internal virtual void OnGenerateDocComment (DeclSpace ds, XmlElement intermediateNode)
+ {
+ }
+
+ //
+ // Returns a string that represents the signature for this
+ // member which should be used in XML documentation.
+ //
+ public virtual string GetDocCommentName (DeclSpace ds)
+ {
+ if (ds == null || this is DeclSpace)
+ return DocCommentHeader + Name;
+ else
+ return String.Concat (DocCommentHeader, ds.Name, ".", Name);
+ }
+
+ //
+ // Generates xml doc comments (if any), and if required,
+ // handle warning report.
+ //
+ internal virtual void GenerateDocComment (DeclSpace ds)
+ {
+ DocUtil.GenerateDocComment (this, ds);
+ }
}
/// <summary>
caching_flags &= ~Flags.HasCompliantAttribute_Undetected;
if (OptAttributes != null) {
- Attribute cls_attribute = OptAttributes.GetClsCompliantAttribute (ec);
+ Attribute cls_attribute = OptAttributes.Search (TypeManager.cls_compliant_attribute_type, ec);
if (cls_attribute != null) {
caching_flags |= Flags.HasClsCompliantAttribute;
if (cls_attribute.GetClsCompliantAttributeValue (this)) {
Timer.StopTimer (TimerType.CacheInit);
}
- public MemberCache (IMemberContainer container, Type[] ifaces)
+ public MemberCache (Type[] ifaces)
{
- this.Container = container;
+ //
+ // The members of this cache all belong to other caches.
+ // So, 'Container' will not be used.
+ //
+ this.Container = null;
member_hash = new Hashtable ();
if (ifaces == null)
return;
- foreach (Type itype in ifaces) {
- IMemberContainer iface_container =
- TypeManager.LookupMemberContainer (itype);
-
- MemberCache iface_cache = iface_container.MemberCache;
-
- AddHashtable (member_hash, iface_cache);
- }
+ foreach (Type itype in ifaces)
+ AddCacheContents (TypeManager.LookupMemberCache (itype));
}
/// <summary>
IDictionaryEnumerator it = parent.member_hash.GetEnumerator ();
while (it.MoveNext ()) {
hash [it.Key] = ((ArrayList) it.Value).Clone ();
- }
+ }
return hash;
}
/// <summary>
- /// Add the contents of `new_hash' to `hash'.
+ /// Add the contents of `cache' to the member_hash.
/// </summary>
- void AddHashtable (Hashtable hash, MemberCache cache)
+ void AddCacheContents (MemberCache cache)
{
- Hashtable new_hash = cache.member_hash;
- IDictionaryEnumerator it = new_hash.GetEnumerator ();
+ IDictionaryEnumerator it = cache.member_hash.GetEnumerator ();
while (it.MoveNext ()) {
- ArrayList list = (ArrayList) hash [it.Key];
+ ArrayList list = (ArrayList) member_hash [it.Key];
if (list == null)
- hash [it.Key] = list = new ArrayList ();
+ member_hash [it.Key] = list = new ArrayList ();
ArrayList entries = (ArrayList) it.Value;
for (int i = entries.Count-1; i >= 0; i--) {