return false;
}
- if (!CodeGen.Assembly.IsClsCompliant) {
- if (HasClsCompliantAttribute) {
+ if (HasClsCompliantAttribute) {
+ if (CodeGen.Assembly.ClsCompliantAttribute == null && !CodeGen.Assembly.IsClsCompliant) {
Report.Error (3014, Location,
"`{0}' cannot be marked as CLS-compliant because the assembly is not marked as CLS-compliant",
GetSignatureForError ());
+ return false;
+ }
+
+ if (!Parent.IsClsComplianceRequired ()) {
+ Report.Warning (3018, 1, Location, "`{0}' cannot be marked as CLS-compliant because it is a member of non CLS-compliant type `{1}'",
+ GetSignatureForError (), Parent.GetSignatureForError ());
+ return false;
}
- return false;
}
if (member_name.Name [0] == '_') {
public bool CheckAccessLevel (Type check_type)
{
TypeBuilder tb;
- if ((this is GenericMethod) || (this is Iterator))
+ if (this is GenericMethod)
tb = Parent.TypeBuilder;
else
tb = TypeBuilder;
// May also be null when resolving top-level attributes.
return true;
- if (TypeManager.IsGenericParameter (check_type))
- return true; // FIXME
-
- TypeAttributes check_attr = check_type.Attributes & TypeAttributes.VisibilityMask;
-
//
// Broken Microsoft runtime, return public for arrays, no matter what
// the accessibility is for their underlying class, and they return
if (check_type.IsArray || check_type.IsPointer)
return CheckAccessLevel (TypeManager.GetElementType (check_type));
+ if (TypeManager.IsGenericParameter(check_type))
+ return true; // FIXME
+
+ TypeAttributes check_attr = check_type.Attributes & TypeAttributes.VisibilityMask;
+
switch (check_attr){
case TypeAttributes.Public:
return true;
//
public bool AsAccessible (Type p, int flags)
{
- if (TypeManager.IsGenericParameter (p))
- return true; // FIXME
-
//
// 1) if M is private, its accessability is the same as this declspace.
// we already know that P is accessible to T before this method, so we
while (p.IsArray || p.IsPointer || p.IsByRef)
p = TypeManager.GetElementType (p);
-
+
+ if (TypeManager.IsGenericParameter(p))
+ return true; // FIXME
+
AccessLevel pAccess = TypeEffectiveAccessLevel (p);
AccessLevel mAccess = this.EffectiveAccessLevel &
GetAccessLevelFromModifiers (flags);
the_parent = null;
int start = 0;
- TypeParameter[] parent_params = null;
- if ((the_parent != null) && the_parent.IsGeneric) {
- parent_params = the_parent.initialize_type_params ();
- start = parent_params != null ? parent_params.Length : 0;
- }
-
ArrayList list = new ArrayList ();
- if (parent_params != null)
+ if (the_parent != null && the_parent.IsGeneric) {
+ // FIXME: move generics info out of DeclSpace
+ TypeParameter[] parent_params = the_parent.PartialContainer.TypeParameters;
+ start = parent_params.Length;
list.AddRange (parent_params);
-
+ }
+
int count = type_params != null ? type_params.Length : 0;
for (int i = 0; i < count; i++) {
TypeParameter param = type_params [i];
}
IDictionary cache = TypeManager.AllClsTopLevelTypes;
+ if (cache == null)
+ return true;
+
string lcase = Name.ToLower (System.Globalization.CultureInfo.InvariantCulture);
if (!cache.Contains (lcase)) {
cache.Add (lcase, this);
return null;
}
+
+ public MemberInfo FindBaseEvent (Type invocationType, string name)
+ {
+ ArrayList applicable;
+ if (method_hash != null)
+ applicable = (ArrayList) method_hash [name];
+ else
+ applicable = (ArrayList) member_hash [name];
+
+ if (applicable == null)
+ return null;
+
+ //
+ // Walk the chain of events, starting from the top.
+ //
+ for (int i = applicable.Count - 1; i >= 0; i--)
+ {
+ CacheEntry entry = (CacheEntry) applicable [i];
+ if ((entry.EntryType & EntryType.Event) == 0)
+ continue;
+
+ EventInfo ei = (EventInfo)entry.Member;
+ return ei.GetAddMethod (true);
+ }
+
+ return null;
+ }
//
// This finds the method or property for us to override. invocationType is the type where