internal Type GetType(String typeName){
if (this.cachedTypeLookups == null)
this.cachedTypeLookups = new SimpleHashtable(1000);
object cacheResult = this.cachedTypeLookups[typeName];
if (cacheResult == null){
// proceed with lookup
for (int i = 0, n = this.Scopes.Count; i < n; i++){
GlobalScope scope = (GlobalScope)this.scopes[i];
Type result = Globals.TypeRefs.ToReferenceContext(scope.GetType()).Assembly.GetType(typeName, false);
if (result != null){
this.cachedTypeLookups[typeName] = result;
return result;
}
}
if (this.runtimeAssembly != null) {
this.AddReferences();
this.runtimeAssembly = null;
}
for (int i = 0, n = this.vsaItems.Count; i < n; i++){
object item = this.vsaItems[i];
if (item is VsaReference){
Type result = ((VsaReference)item).GetType(typeName);
if (result != null){
this.cachedTypeLookups[typeName] = result;
return result;
}
}
}
if (this.implicitAssemblies == null){
this.cachedTypeLookups[typeName] = false;
return null;
}
for (int i = 0, n = this.implicitAssemblies.Count; i < n; i++){
Assembly assembly = (Assembly)this.implicitAssemblies[i];
Type result = assembly.GetType(typeName, false);
if (result != null){
if (!result.IsPublic || CustomAttribute.IsDefined(result, typeof(System.Runtime.CompilerServices.RequiredAttributeAttribute), true))
result = null; //Suppress the type if it is not public or if it is a funky C++ type.
else{
this.cachedTypeLookups[typeName] = result;
return result;
}
}
}
this.cachedTypeLookups[typeName] = false;
return null;
}
return (cacheResult as Type);
}