final boolean isInterface = (iinfo.flags & ABCConstants.CONSTANT_ClassInterface) != 0;
assert iinfo.name.getKind() == ABCConstants.CONSTANT_Qname;
String typeName = iinfo.name.getBaseName();
final Namespace namespace = iinfo.name.getSingleQualifier();
final String namespaceName = namespace.getName();
final int namespaceKind = namespace.getKind();
INamespaceReference namespaceRef = null;
if (namespaceName.length() != 0 &&
((namespaceKind == ABCConstants.CONSTANT_PackageNs) || (namespaceKind == ABCConstants.CONSTANT_PackageInternalNs)))
{
namespaceRef =
((Workspace)workspace).getPackageNamespaceDefinitionCache().get(namespaceName, namespaceKind == ABCConstants.CONSTANT_PackageInternalNs);
}
else
{
namespaceRef = NamespaceDefinition.createNamespaceDefinition(namespace);
}
final TypeDefinitionBase typeDefinition;
if (isInterface)
{
final InterfaceDefinition interfaceDefinition = new InterfaceDefinition(typeName);
final IReference[] extendedInterfaces = getReferences(iinfo.interfaceNames);
interfaceDefinition.setExtendedInterfaceReferences(extendedInterfaces);
setupCastFunction(iinfo, interfaceDefinition);
typeDefinition = interfaceDefinition;
}
else
{
String protectedNSURI;
if (iinfo.hasProtectedNs())
protectedNSURI = iinfo.protectedNs.getName();
else
{
String classNSURI = namespace.getName();
protectedNSURI = (classNSURI.isEmpty() ? "" : classNSURI + ":") + typeName;
}
NamespaceDefinition.IProtectedNamespaceDefinition protectedNSDefinition = NamespaceDefinition.createProtectedNamespaceDefinition(protectedNSURI);
final ClassDefinition classDefinition = new ClassDefinition(typeName, namespaceRef, protectedNSDefinition);