public readonly string Namespace;
public readonly string Name;
public StandardModule(string _namespace, string name) { Namespace = _namespace; Name = name; }
+ public override string ToString() { return ((Namespace != null && Namespace.Length > 0)?(Namespace + "."):"") + Name; }
}
private static StandardModule[] standardModules;
if (standardModules != null)
standardModules.CopyTo (n, 0);
- n [top] = new StandardModule(module.Namespace.Name, module.Name) ;
+ string name = module.Name;
+ int split = name.LastIndexOf('.');
+ if (split > 0)
+ name = name.Substring(split+1);
+ n [top] = new StandardModule(module.Namespace.Name, name);
+ //Console.WriteLine("Standard Module added:" + module.Name + " [" + n [top] + "]");
standardModules = n;
}
///
private static void AddStandardModule(Type type)
{
- int top = standardModules != null ? standardModules.Length : 0;
- StandardModule [] n = new StandardModule [top + 1];
+ object[] attributes = type.GetCustomAttributes(false);
+ for (int i = 0; i < attributes.Length; i ++) {
+ if (attributes[i].ToString() == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute") {
+ int top = standardModules != null ? standardModules.Length : 0;
+ StandardModule [] n = new StandardModule [top + 1];
- if (standardModules != null)
- standardModules.CopyTo (n, 0);
- n [top] = new StandardModule(type.Namespace, type.Name) ;
- standardModules = n;
+ if (standardModules != null)
+ standardModules.CopyTo (n, 0);
+ n [top] = new StandardModule(type.Namespace, type.Name) ;
+ standardModules = n;
+
+ return;
+ }
+ }
}
//
foreach(string Namespace in namespaces)
{
for(int i = 0; i < standardModules.Length; i++)
- if (standardModules[i].Namespace == Namespace)
- list.Add(LookupType(Namespace + "." + standardModules[i].Name));
+ if (standardModules[i].Namespace == Namespace) {
+ string name = standardModules[i].ToString();
+ Type t = LookupType(name);
+ if (t == null) {
+ System.Console.WriteLine("Could not find standard module '" + name + "'");
+ }
+ else {
+ list.Add(t);
+ }
+ }
}
return (Type[])list.ToArray(typeof(Type));
}
{
CaseInsensitiveHashtable namespaces = new CaseInsensitiveHashtable ();
- foreach (Assembly a in assemblies){
- foreach (Type t in a.GetTypes ()){
+ foreach (Assembly a in assemblies) {
+ foreach (Type t in a.GetTypes ()) {
string ns = t.Namespace;
if (namespaces.Contains (ns))
}
}
- foreach (ModuleBuilder mb in modules){
- foreach (Type t in mb.GetTypes ()){
+ foreach (ModuleBuilder mb in modules) {
+ foreach (Type t in mb.GetTypes ()) {
string ns = t.Namespace;
if (namespaces.Contains (ns))
namespaces [ns] = ns;
}
}
+
return namespaces;
}
return (MethodInfo) de.Second;
} else
- return pi.GetSetMethod ();
+ return pi.GetSetMethod (true);
}
static public MethodInfo GetPropertySetter (PropertyInfo pi)
return (MethodInfo) de.First;
} else
- return pi.GetGetMethod ();
+ return pi.GetGetMethod (true);
}
/// <summary>
ArrayList method_list = null;
Type current_type = queried_type;
+ if (queried_type == null)
+ throw new ArgumentNullException("queried_type");
bool searching = (original_bf & BindingFlags.DeclaredOnly) == 0;
bool private_ok;
bool always_ok_flag = false;
closure_queried_type = current_type;
Timer.StopTimer (TimerType.MemberLookup);
-bf |= BindingFlags.IgnoreCase;
+ bf |= BindingFlags.IgnoreCase;
list = MemberLookup_FindMembers (current_type, mt, bf, name, out used_cache);
Timer.StartTimer (TimerType.MemberLookup);