// and have multiple compilation passes, so we have to have our own
// version of this code
CompilerContext flexCx = unit.getContext();
// Don't do the HashMap lookup for the context. access strongly typed
// variable for the ASC Context from CompilerContext
Context cx = flexCx.getAscContext();
ProgramNode node = (ProgramNode)unit.getSyntaxTree();
// stop processing if unit.topLevelDefinitions.first() is null
if (unit.topLevelDefinitions.first() == null)
{
return;
}
String className = NameFormatter.toDot(unit.topLevelDefinitions.first());
boolean exclude = false;
if (includeOnly != null && !includeOnly.contains(className))
{
exclude = true;
}
else if (excludeClasses.contains(className))
{
excludeClasses.remove(className);
exclude = true;
}
// check the metadata for ExcludeClass. Like Flex Builder, ASDoc uses
// this compiler metadata to
// determine which classes should not be visible to the user
else if (unit.metadata != null)
{
for (Iterator iterator = unit.metadata.iterator(); iterator.hasNext();)
{
MetaDataNode metaDataNode = (MetaDataNode)iterator.next();
if (EXCLUDE_CLASS.equals(metaDataNode.getId()))
{
exclude = true;
break;
}
}
}
// the inheritance needs to be processed in a predictable order..
Set<QName> inheritance = new TreeSet<QName>(new ComparatorImpl());
for (Name name : unit.inheritance)
{
if (name instanceof QName)
{
inheritance.add((QName) name);
}
}
boolean flag = false;
if (!exclude && !unit.getSource().isInternal())
{
if (Trace.asdoc)
System.out.println("Generating XML for " + unit.getSource().getName());
flag = false;
}
else
{
if (Trace.asdoc)
System.out.println("Skipping generating XML for " + unit.getSource().getName());
flag = true;
}
if (packages.size() != 0)
{
String n = unit.topLevelDefinitions.first().getNamespace();
if (n != null)
{
packages.remove(n);
}
}
cx.pushScope(node.frame);
MetaDataEvaluator printer = new MetaDataEvaluator();
node.evaluate(cx, printer);
ObjectList comments = printer.doccomments;
AbcClass abcClass = typeTable.getClass(unit.topLevelDefinitions.first().toString());
tab.addComments(unit.topLevelDefinitions.first(), comments, inheritance, flag, cx, abcClass);
cx.popScope();
}