* <p>InterfaceAnalyzer then adds additional stuff from the DOM, prior to interface codegen
*/
private DocumentInfo createDocumentInfo(CompilationUnit unit, DocumentNode app, Source source)
{
StandardDefs standardDefs = unit.getStandardDefs();
DocumentInfo info = new DocumentInfo(source.getNameForReporting(), standardDefs);
// set MXML root
info.setRootNode(app, app.beginLine);
// package/class is derived from source name and location
info.setClassName(source.getShortName());
info.setPackageName(source.getRelativePath().replace('/','.'));
// superclass is derived from root node name
// first, check to see if the base class is a local class
String superClassName = info.getLocalClass(app.getNamespace(), app.getLocalPart());
// otherwise, check the usual manifest mappings
if (superClassName == null)
superClassName = nameMappings.resolveClassName(app.getNamespace(), app.getLocalPart());
if (superClassName != null)
{
info.setQualifiedSuperClassName(NameFormatter.toDot(superClassName), app.beginLine);
}
else
{
ThreadLocalToolkit.log(new AnalyzerAdapter.CouldNotResolveToComponent(app.image), source, app.beginLine);
return null;
}
// interfaces specified by "implements" attribute.
// TODO "implements" is language def, it should be in a list of language constants somewhere
String interfaceNames = (String) app.getAttributeValue("implements");
if (interfaceNames != null)
{
StringTokenizer t = new StringTokenizer(interfaceNames, ",");
while (t.hasMoreTokens())
{
info.addInterfaceName(t.nextToken().trim(), app.getLineNumber("implements"));
}
}
// seed import name set with the unconditional imports present in all generated MXML classes
if (mxmlConfiguration.getGenerateAbstractSyntaxTree())
{
info.addSplitImportNames(StandardDefs.splitImplicitImports);
// See SDK-16946
if (info.getVersion() >= 4)
{
info.removeSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
info.addSplitImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS),
StandardDefs.splitPackageMxFilters);
}
if (mxmlConfiguration.getCompilingForAIR())
{
info.addSplitImportNames(StandardDefs.splitAirOnlyImplicitImports);
}
info.addSplitImportNames(standardDefs.getSplitStandardMxmlImports());
}
else
{
info.addImportNames(StandardDefs.implicitImports, app.beginLine);
// See SDK-16946
if (info.getVersion() >= 4)
{
info.removeImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_FLASH_FILTERS));
info.addImportName(NameFormatter.toDotStar(StandardDefs.PACKAGE_MX_FILTERS), app.beginLine);
}
if (mxmlConfiguration.getCompilingForAIR())
{
info.addImportNames(StandardDefs.airOnlyImplicitImports, app.beginLine);
}
info.addImportNames(standardDefs.getStandardMxmlImports(), app.beginLine);
}
return info;
}