// Contains all public types from referenced assemblies.
// This member is used only if CLS Compliance verification is required.
// </remarks>
- public static Hashtable all_imported_types;
+ public static Hashtable AllClsTopLevelTypes;
static Hashtable fieldbuilders_to_fields;
static Hashtable fields;
builder_to_method = null;
fields = null;
- builder_to_constant = null;
fieldbuilders_to_fields = null;
events = null;
priv_fields_events = null;
- properties = null;
type_hash = null;
TypeHandle.CleanUp ();
return builder_to_declspace [t] as Delegate;
}
- public static Enum LookupEnum (Type t)
- {
- return builder_to_declspace [t] as Enum;
- }
-
public static Class LookupClass (Type t)
{
return (Class) builder_to_declspace [t];
Assembly a = assemblies [i];
string [] namespaces = (string []) assembly_get_namespaces.Invoke (a, null);
foreach (string ns in namespaces){
- if (ns == "")
+ if (ns.Length == 0)
continue;
Namespace.LookupNamespace (ns, true);
}
/// </summary>
public static void LoadAllImportedTypes ()
{
- all_imported_types = new Hashtable ();
+ AllClsTopLevelTypes = new Hashtable (1500);
foreach (Assembly a in assemblies) {
foreach (Type t in a.GetExportedTypes ()) {
- all_imported_types [t.FullName] = t;
+ AllClsTopLevelTypes [t.FullName.ToLower (System.Globalization.CultureInfo.InvariantCulture)] = null;
}
}
}
if (mb.IsSpecialName && !mb.IsConstructor) {
if (iparams.Count > 1) {
sig.Append ("this[");
- int before_ret_val = parameters.LastIndexOf (',');
- sig.Append (parameters.Substring (1, before_ret_val - 1));
+ if (show_accessor) {
+ sig.Append (parameters.Substring (1, parameters.Length - 2));
+ }
+ else {
+ int before_ret_val = parameters.LastIndexOf (',');
+ sig.Append (parameters.Substring (1, before_ret_val - 1));
+ }
sig.Append (']');
} else {
sig.Append (mb.Name.Substring (4));
public static bool IsEnumType (Type t)
{
- if (t.IsSubclassOf (TypeManager.enum_type))
+ if (builder_to_declspace [t] is Enum)
return true;
- else
- return false;
+
+ return t.IsEnum;
}
+
public static bool IsBuiltinOrEnum (Type t)
{
if (IsBuiltinType (t))
{
return t.IsArray || t.IsPointer || t.IsByRef;
}
-
- static Hashtable builder_to_constant;
-
- public static void RegisterConstant (FieldBuilder fb, Const c)
- {
- if (builder_to_constant == null)
- builder_to_constant = new PtrHashtable ();
-
- if (builder_to_constant.Contains (fb))
- return;
-
- builder_to_constant.Add (fb, c);
- }
-
- public static Const LookupConstant (FieldBuilder fb)
- {
- if (builder_to_constant == null)
- return null;
-
- return (Const) builder_to_constant [fb];
- }
/// <summary>
/// Gigantic work around for missing features in System.Reflection.Emit follows.
}
}
- // <remarks>
- // This is a workaround the fact that GetValue is not
- // supported for dynamic types
- // </remarks>
- static public bool RegisterFieldValue (FieldBuilder fb, object value)
+ public static void RegisterConstant (FieldInfo fb, IConstant ic)
{
- if (fields.Contains (fb))
- return false;
-
- fields.Add (fb, value);
-
- return true;
+ fields.Add (fb, ic);
}
- static public object GetValue (FieldBuilder fb)
+ public static IConstant GetConstant (FieldInfo fb)
{
- return fields [fb];
+ if (fb == null)
+ return null;
+
+ return (IConstant)fields [fb];
}
static public bool RegisterFieldBase (FieldBuilder fb, FieldBase f)
return (MemberInfo) priv_fields_events [ei];
}
- static Hashtable properties;
-
- static public bool RegisterProperty (PropertyBuilder pb, MethodBase get, MethodBase set)
- {
- if (properties == null)
- properties = new Hashtable ();
-
- if (properties.Contains (pb))
- return false;
-
- properties.Add (pb, new Pair (get, set));
-
- return true;
- }
-
static public bool RegisterIndexer (PropertyBuilder pb, MethodBase get,
MethodBase set, Type[] args)
{
- if (!RegisterProperty (pb, get,set))
- return false;
-
indexer_arguments.Add (pb, args);
return true;