}
public void parse2(CompilationUnit unit, SymbolTable symbolTable)
{
DocumentInfo docInfo = (DocumentInfo) unit.getContext().getAttribute(MxmlCompiler.DOCUMENT_INFO);
Source source = unit.getSource();
// get parsed superclass info - NOTE may be null in case of error
ClassInfo baseClassInfo = getClassInfo(source, symbolTable, docInfo.getQualifiedSuperClassName());
if (baseClassInfo == null && docInfo.getQualifiedSuperClassName() != null)
{
String qualifiedClassName = NameFormatter.toDot(docInfo.getPackageName(), docInfo.getClassName());
ThreadLocalToolkit.log(new BaseClassNotFound(qualifiedClassName, docInfo.getQualifiedSuperClassName()), source);
return;
}
// InterfaceAnalyzer will collect items to be included in generated interface code, and add them to info
InterfaceAnalyzer analyzer = new InterfaceAnalyzer(unit, docInfo, baseClassInfo, mxmlConfiguration.getGenerateAbstractSyntaxTree());
DocumentNode app = (DocumentNode) unit.getContext().getAttribute(DOCUMENT_NODE);
app.analyze(analyzer);
if (ThreadLocalToolkit.errorCount() > 0)
{
return;
}
// generate AS for the interface (i.e., public signature) of our class. This will include
// - superclass, interface and metadata declarations, as specified in the MXML
// - public var declarations for id-attributed children of the MXML
// - user-supplied script code
LineNumberMap map = new LineNumberMap(source.getName());
Source newSource;
Logger original = ThreadLocalToolkit.getLogger();
if (mxmlConfiguration.getGenerateAbstractSyntaxTree())
{
Logger adapter = new AbstractSyntaxTreeLogAdapter(original);
ThreadLocalToolkit.setLogger(adapter);
newSource = generateSkeletonAST(docInfo, analyzer.bogusImports, source, symbolTable);
}
else
{
MxmlLogAdapter adapter = new MxmlLogAdapter(original, map);
adapter.addLineNumberMaps(unit.getSource().getSourceFragmentLineMaps());
ThreadLocalToolkit.setLogger(adapter);
newSource = generateSkeleton(docInfo, analyzer.bogusImports, map, source);
if (newSource == null)
{
ThreadLocalToolkit.setLogger(original);
return;
}
map.setNewName(newSource.getName());
}
// use ASC to produce new CU for generated interface source. Will be managed by "outer" MXML CU
CompilationUnit interfaceUnit = compileInterface(newSource, source, docInfo, map, symbolTable);