static public ConstructorInfo void_decimal_ctor_five_args;
static public ConstructorInfo void_datetime_ctor_ticks_arg;
static public ConstructorInfo unverifiable_code_ctor;
+ static public ConstructorInfo default_member_ctor;
// <remarks>
// Holds the Array of Assemblies that have been loaded
// <remarks>
static Hashtable method_internal_params;
- // <remarks>
- // Keeps track of attribute types
- // </remarks>
-
- static Hashtable builder_to_attr;
-
// <remarks>
// Keeps track of methods
// </remarks>
user_types = new ArrayList ();
types = new CaseInsensitiveHashtable ();
+ negative_hits = new CaseInsensitiveHashtable ();
typecontainers = new CaseInsensitiveHashtable ();
builder_to_declspace = new PtrHashtable ();
- builder_to_attr = new PtrHashtable ();
builder_to_method = new PtrHashtable ();
method_arguments = new PtrHashtable ();
method_internal_params = new PtrHashtable ();
builder_to_method.Add (builder, method);
}
- public static void RegisterAttrType (Type t, TypeContainer tc)
- {
- builder_to_attr.Add (t, tc);
- }
-
/// <summary>
/// Returns the TypeContainer whose Type is 't' or null if there is no
/// TypeContainer for 't' (ie, the Type comes from a library)
{
return builder_to_declspace [t] as Enum;
}
-
- public static TypeContainer LookupAttr (Type t)
+
+ public static TypeContainer LookupClass (Type t)
{
- return (TypeContainer) builder_to_attr [t];
+ return builder_to_declspace [t] as TypeContainer;
}
/// <summary>
return null;
}
+ static CaseInsensitiveHashtable negative_hits;
//
// This function is used when you want to avoid the lookups, and want to go
// directly to the source. This will use the cache.
if (t != null)
return t;
+ if (negative_hits.Contains (name))
+ return null;
t = LookupTypeReflection (name);
if (t == null)
- return null;
-
- types [name] = t;
+ negative_hits [name] = null;
+ else
+ types [name] = t;
return t;
}
if (t != null)
return t;
+ if (negative_hits.Contains (name))
+ return null;
+
//
// Optimization: ComposedCast will work with an existing type, and might already have the
// full name of the type, so the full system lookup can probably be avoided.
for (int n = 1; n <= count; n++){
string top_level_type = String.Join (".", elements, 0, n);
+ if (negative_hits.Contains (top_level_type))
+ continue;
+
t = (Type) types [top_level_type];
if (t == null){
t = LookupTypeReflection (top_level_type);
- if (t == null)
+ if (t == null){
+ negative_hits [top_level_type] = null;
continue;
+ }
}
if (count == n){
}
string newt = top_level_type + "+" + String.Join ("+", elements, n, count - n);
- t = LookupTypeDirect (newt);
- if (t != null)
- types [newt] = t;
+ t = LookupTypeReflection (newt);
+ if (t == null)
+ negative_hits [name] = null;
+ else
+ types [name] = t;
return t;
}
+ negative_hits [name] = null;
return null;
}
unverifiable_code_ctor = GetConstructor (
unverifiable_code_type, void_arg);
+ default_member_ctor = GetConstructor (
+ default_member_type, string_);
}
const BindingFlags instance_and_static = BindingFlags.Static | BindingFlags.Instance;
indexer_arguments.Add (indexer, types);
return types;
}
- /*else \r
+ /*else
{
ParameterInfo [] pi = indexer.GetIndexParameters ();
// Property, not an indexer.
if (t.IsInterface) {
Interface i = LookupInterface (t);
- if ((i == null) || (i.IndexerName == null))
+ if ((i == null) || (i.DefaultPropName == null))
return "Item";
- return i.IndexerName;
+ return i.DefaultPropName;
} else {
TypeContainer tc = LookupTypeContainer (t);
- if ((tc == null) || (tc.IndexerName == null))
+ if ((tc == null) || (tc.DefaultPropName == null))
return "Item";
- return tc.IndexerName;
+ return tc.DefaultPropName;
}
}