- Type DefineTypeAndParents (DeclSpace tc)
- {
- DeclSpace container = tc.Parent;
-
- if (container.TypeBuilder == null && container.Name != "")
- DefineTypeAndParents (container);
-
- return tc.DefineType ();
- }
-
- Type LookupInterfaceOrClass (string ns, string name, out bool error)
- {
- DeclSpace parent;
- Type t;
- object r;
-
- error = false;
- int p = name.LastIndexOf ('.');
-
- if (dh.Lookup (ns, name, out r))
- return (Type) r;
- else {
- //
- // If the type is not a nested type, we do not need `LookupType's processing.
- // If the @name does not have a `.' in it, this cant be a nested type.
- //
- if (ns != ""){
- if (Namespace.IsNamespace (ns)) {
- if (p != -1)
- t = TypeManager.LookupType (ns + "." + name);
- else
- t = TypeManager.LookupTypeDirect (ns + "." + name);
- } else
- t = null;
- } else if (p != -1)
- t = TypeManager.LookupType (name);
- else
- t = TypeManager.LookupTypeDirect (name);
- }
-
- if (t != null) {
- dh.Insert (ns, name, t);
- return t;
- }
-
- //
- // In case we are fed a composite name, normalize it.
- //
-
- if (p != -1){
- ns = MakeFQN (ns, name.Substring (0, p));
- name = name.Substring (p+1);
- }
-
- parent = RootContext.Tree.LookupByNamespace (ns, name);
- if (parent == null) {
- dh.Insert (ns, name, null);
- return null;
- }
-
- t = DefineTypeAndParents (parent);
- if (t == null){
- error = true;
- return null;
- }
-
- dh.Insert (ns, name, t);
- return t;
- }
-
- public static void Error_AmbiguousTypeReference (Location loc, string name, Type t1, Type t2)