if (compilationUnit != null)
{
for (QName topLevelDefinition : compilationUnit.topLevelDefinitions)
{
SwcScript swcScript = compilerSwcContext.getCachedScript(topLevelDefinition);
// Make sure the SwcScript's cached CompilationUnit isn't reused.
if (swcScript != null)
{
CompilationUnit swcScriptCompilationUnit = swcScript.getCompilationUnit();
if (swcScriptCompilationUnit != null)
{
// SwcContext's getSource() has the side effect of
// copying cached type information into a new
// Source object, so we need to clean that up too.
swcScriptCompilationUnit.getSource().removeCompilationUnit();
swcScript.setCompilationUnit(null);
}
}
}
}