new Namespace(ABCConstants.CONSTANT_PackageNs, "mx.core"),
"IFlexModuleFactory");
paramTypes.add(flexModuleFactoryTypeName);
methodInfo.setParamTypes(paramTypes);
final InstructionList methodInstructions = new InstructionList();
// super.moduleFactory = factory;
methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
methodInstructions.addInstruction(ABCConstants.OP_getlocal1);
methodInstructions.addInstruction(ABCConstants.OP_setsuper, moduleFactoryName);
// if (mfi)
// return;
Label label1 = new Label();
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_getproperty, NAME_MODULE_FACTORY_INITIALIZED);
methodInstructions.addInstruction(OP_iffalse, label1);
methodInstructions.addInstruction(OP_returnvoid);
methodInstructions.labelNext(label1);
// mfi = true;
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_pushtrue);
methodInstructions.addInstruction(OP_setproperty, NAME_MODULE_FACTORY_INITIALIZED);
if (hasStyleSpecifiers || hasEffectSpecifiers)
{
FlexProject project = this.getProject();
Name cssStyleDeclarationName = project.getCSSStyleDeclarationClassName();
// Create an anonymous function from the style and effect-style specifiers
// for the class definition tag. It will be set as the value of
// styleDeclaration.defaultFactory.
MethodInfo styleDeclarationDefaultFactory = createStyleDeclarationDefaultFactory(context);
// if (this.styleDeclaration == null)
// this.styleDeclaration = new CSSStyleDeclaration(null, this.styleManager);
Label label2 = new Label();
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_DECLARATION);
methodInstructions.addInstruction(OP_iftrue, label2);
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_findpropstrict, cssStyleDeclarationName);
methodInstructions.addInstruction(OP_pushnull);
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_MANAGER);
methodInstructions.addInstruction(OP_constructprop, new Object[] { cssStyleDeclarationName, 2} );
methodInstructions.addInstruction(OP_setproperty, NAME_STYLE_DECLARATION);
methodInstructions.labelNext(label2);
// this.styleDeclaration.defaultFactory = <anonymous function>
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addInstruction(OP_getproperty, NAME_STYLE_DECLARATION);
methodInstructions.addInstruction(OP_newfunction, styleDeclarationDefaultFactory);
methodInstructions.addInstruction(OP_setproperty, NAME_DEFAULT_FACTORY);
}
if (hasEffectSpecifiers)
{
// this.registerEffects([ ... ]);
methodInstructions.addInstruction(OP_getlocal0);
methodInstructions.addAll(context.get(IL.MODULE_FACTORY_EFFECTS));
methodInstructions.addInstruction(OP_newarray, context.getCounter(IL.MODULE_FACTORY_EFFECTS));
methodInstructions.addInstruction(OP_callpropvoid, REGISTER_EFFECTS_CALL_OPERANDS);
}
if (hasStyleTags)
{
// generateCSSStyleDeclarationsForComponents(super.styleManager, factoryFunctions, data);
methodInstructions.addInstruction(ABCConstants.OP_getlex, styleManagerReferenceName);
methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
methodInstructions.addInstruction(ABCConstants.OP_getsuper, NAME_STYLE_MANAGER);
methodInstructions.addInstruction(ABCConstants.OP_getlex, CSSReducer.NAME_FACTORY_FUNCTIONS);
methodInstructions.addInstruction(ABCConstants.OP_getlex, CSSReducer.NAME_DATA_ARRAY);
methodInstructions.addInstruction(ABCConstants.OP_callproperty, new Object[] { NAME_GENERATE_CSSSTYLEDECLARATIONS, 3 });
}
// styleManager.initProtoChainRoots();
methodInstructions.addInstruction(ABCConstants.OP_getlocal0);
methodInstructions.addInstruction(ABCConstants.OP_getsuper, NAME_STYLE_MANAGER);
methodInstructions.addInstruction(ABCConstants.OP_callpropvoid, new Object[] {new Name("initProtoChainRoots"), 0 });
methodInstructions.addInstruction(ABCConstants.OP_returnvoid);
generateMethodBody(methodInfo, classScope, methodInstructions);
addSetter(moduleFactoryName, methodInfo, true);
}