// NOTE Here we watch for specific generated loose code units we have carnal knowledge of, and add their
// definitions as deps to the main unit.
// TODO Remove once serverconfigdata is handled within the standard bootstrap setup.
//
Source source = unit.getSource();
String sourceName = source.getName();
if (sourceName.equals("serverConfigData.as"))
{
serverConfigDef = unit.topLevelDefinitions.first().toString();
}
CULinkable linkable = new CULinkable( unit );
if (unit.isRoot())
mainLinkable = linkable;
if (source.isInternal())
{
externs.addAll( unit.topLevelDefinitions.getStringSet() );
}
linkables.add( linkable );
}
frames = new ArrayList<Frame>();
// FIXME - hook serverconfigdata to FlexInit mixin
if (mainLinkable != null)
{
if (serverConfigDef != null)
mainLinkable.addDep(serverConfigDef);
}
try
{
final Set<SwcLibrary> librariesProcessed = new HashSet<SwcLibrary>();
int counter = 0;
DependencyWalker.LinkState state = new DependencyWalker.LinkState( linkables, externs, includes, unresolved );
for (Iterator<FrameInfo> it = frameInfoList.iterator(); it.hasNext();)
{
FramesConfiguration.FrameInfo frameInfo = it.next();
final Frame f = new Frame();
f.pos = ++counter;
if (frameInfo.label != null)
{
f.label = new FrameLabel();
f.label.label = frameInfo.label;
}
// note that we only allow externs on the last frame
DependencyWalker.traverse( frameInfo.frameClasses, state, !it.hasNext(), !it.hasNext(),
getInheritanceDependenciesOnly(),
new Visitor<Linkable>()
{
public void visit( Linkable o )
{
// FIXME - keep an eye on those lazy abcs... do we have loose script?
// TODO yep! delete "false &&" once loose-script bootstrapping code has been eliminated - see note above
CULinkable l = (CULinkable) o;
// exportUnitOnFrame( l.getUnit(), f, false);// && !l.hasDefinition( frameClass ) );
exportUnitOnFrame( l.getUnit(), f, lazyInit);
// for any scripts that we include from libraries, add the libraries keep-as3-metadata
// to the list of metadata we will preserve in postlink.
Source source = l.getUnit().getSource();
if (source.isSwcScriptOwner() && !source.isInternal())
{
SwcScript script = (SwcScript)source.getOwner();
SwcLibrary library = script.getLibrary();
// lots of scripts, but not many swcs, so avoid adding the same metadata
// over and over.
if (!librariesProcessed.contains(library))