CompilerConfiguration compilerConfiguration = configuration.getCompilerConfiguration();
int compatibilityVersion = compilerConfiguration.getCompatibilityVersion();
StandardDefs standardDefs = ThreadLocalToolkit.getStandardDefs();
TypeAnalyzer typeAnalyzer = symbolTable.getTypeAnalyzer();
assert(typeAnalyzer != null);
for (int i = 0, length = units.size(); i < length; i++)
{
CompilationUnit u = (CompilationUnit) units.get(i);
if (u.isRoot())
{
StylesContainer stylesContainer =
(StylesContainer) symbolTable.getContext().getAttribute(StylesContainer.class.getName());
StylesContainer rootStylesContainer = u.getStylesContainer();
// If the backgroundColor wasn't specified inline, go looking for it in CSS.
if ((u.swfMetaData == null) || (u.swfMetaData.getValue("backgroundColor") == null))
{
QName qName = u.topLevelDefinitions.last();
if (qName != null)
{
String def = qName.toString();
lookupBackgroundColor(stylesContainer, rootStylesContainer, u.styleName,
NameFormatter.toDot(def), symbolTable, configuration);
}
}
if (rootStylesContainer != null)
{
// Swap in root's Logger, so warnings get associated correctly.
Logger originalLogger = ThreadLocalToolkit.getLogger();
ThreadLocalToolkit.setLogger(u.getSource().getLogger());
rootStylesContainer.validate(symbolTable, nameMappings, u.getStandardDefs(),
compilerConfiguration.getThemeNames(), null);
ThreadLocalToolkit.setLogger(originalLogger);
}
Source source = u.getSource();
// Now that we're done validating the StyleContainer,
// we can disconnect the root's logger.
source.disconnectLogger();
// Clear the root's path resolver, so the
// CompilationUnit doesn't hold onto the global path
// resolver, which has strong references to things
// like the SourcePath, which we want freed up at the
// end of a compilation. All the other
// CompilationUnit's have their PathResolver cleared
// when they reach the ABC state. We hold onto the
// root's path resolver until now, because of the
// styles
source.setPathResolver(null);
// C: we don't need the styles container anymore
u.setStylesContainer(null);
}
else if (generatedLoaderClass && !u.getSource().isInternal() && !u.getSource().isSwcScriptOwner())
{
// Check if the source is a module or an application. If it is and we know it
// is not the root then generate a warning.
if (typeAnalyzer != null)
{
for (QName qName : u.topLevelDefinitions)
{
ClassInfo info = typeAnalyzer.getClassInfo(qName.toString());
checkForModuleOrApplication(standardDefs, typeAnalyzer, info, qName, configuration);
}
}
}