private boolean addGeneratedStylesClassToFrame(SWFFrame frame, Set<ICompilationUnit> emittedCompilationUnits) throws Exception
{
ABCEmitter emitter = new ABCEmitter();
emitter.visit(ABCConstants.VERSION_ABC_MAJOR_FP10, ABCConstants.VERSION_ABC_MINOR_FP10);
ICSSCodeGenResult cssCodeGenResult = cssCompilationSession.emitStyleDataClass(flexProject, emitter);
Name stylesClassName = new Name(getStylesClassName());
IDefinition objectDef = objectReference.resolve(flexProject);
if ((objectDef == null) || (!(objectDef instanceof ClassDefinition)))
return false;
ClassDefinition objectClassDef = (ClassDefinition)objectDef;
// Generates a Style's class
// Generated class name will be of the form _MyApplication_Styles
// Eg:
// public class _MyApplication_Styles
// {
// }
final InstructionList cinit = cssCodeGenResult.getClassInitializationInstructions();
assert cinit.canFallThrough() : "CSSReducer should not append 'returnvoid' to the initialization instructions.";
cinit.addInstruction(ABCConstants.OP_returnvoid);
ClassGeneratorHelper classGenerator = new ClassGeneratorHelper(
flexProject,
emitter,
stylesClassName,
objectClassDef,
Collections.<Name> emptyList(),
Collections.<Name> emptyList(),
ClassGeneratorHelper.returnVoid(),
cinit,
false);
cssCodeGenResult.visitClassTraits(classGenerator.getCTraitsVisitor());
classGenerator.finishScript();
DoABCTag tag = new DoABCTag();
tag.setABCData(emitter.emit());