public virtual Node LookupTypeOrNamespace(Identifier identifier, bool typeOnly, NamespaceScope nsScope, out TypeNodeList duplicates){ duplicates = null; if (identifier == null || nsScope == null){Debug.Assert(false); return null;} TypeNode t = nsScope.GetType(identifier, out duplicates, true); if (t != null && t.Name != null && t.Name.UniqueIdKey == identifier.UniqueIdKey){ AliasDefinition aliasDef = nsScope.GetConflictingAlias(identifier); if (aliasDef != null) aliasDef.ConflictingType = t; }else if (!typeOnly){ TrivialHashtable alreadySeenAliases = new TrivialHashtable(); AliasDefinition aliasDef = nsScope.GetAliasFor(identifier); while (aliasDef != null){ if (aliasDef.AliasedType != null) return (TypeNode)aliasDef.AliasedType; if (alreadySeenAliases[aliasDef.UniqueKey] != null) break; //TODO: error? alreadySeenAliases[aliasDef.UniqueKey] = aliasDef; if (aliasDef.AliasedAssemblies != null) return aliasDef; if (aliasDef.AliasedExpression is Identifier) aliasDef = nsScope.GetAliasFor(identifier = (Identifier)aliasDef.AliasedExpression); else if (aliasDef.AliasedExpression is QualifiedIdentifier) return this.LookupTypeOrNamespace(aliasDef.AliasedExpression, false); else aliasDef = null; } Identifier ns = nsScope.GetNamespaceFullNameFor(identifier); if (ns != null) return ns; } return t; }