// TODO - definition - this works for now to prevent NPEs
if (typeName == null)
return null;
CompilerProject compilerProject = (CompilerProject)project;
ASScope containingScope = (ASScope)(context.containingScope);
// TODO at some point this method should take some sort of name object.
if (containingScope != null)
{
int lastIndexOfDot = typeName.lastIndexOf('.');
IDefinition foundDefinition = null;
if (lastIndexOfDot != -1)
{
String unqualifiedName = typeName.substring(lastIndexOfDot + 1);
String packageName = typeName.substring(0, lastIndexOfDot);
INamespaceDefinition packageNS = ((CompilerProject)project).getWorkspace().getPackageNamespaceDefinitionCache().get(packageName, false);
foundDefinition = containingScope.findPropertyQualified(compilerProject, packageNS, unqualifiedName, dt, true);
}
else
{
foundDefinition = containingScope.findProperty(compilerProject, typeName, dt, true);
}
assert (foundDefinition == null) || foundDefinition.isInProject(project);
if (foundDefinition instanceof TypeDefinitionBase)
return (TypeDefinitionBase)foundDefinition;