{
Name capabilitiesSlotName = capabilitiesReference.getMName();
initMethod.addInstruction(ABCConstants.OP_findpropstrict, capabilitiesSlotName);
initMethod.addInstruction(ABCConstants.OP_getproperty, capabilitiesSlotName);
initMethod.addInstruction(ABCConstants.OP_getproperty, new Name("hasAccessibility"));
Label accessibilityEnd = new Label();
initMethod.addInstruction(ABCConstants.OP_iffalse, accessibilityEnd);
IResolvedQualifiersReference enableAccessibilityReference = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
"enableAccessibility");
Name enableAccessibilityName = enableAccessibilityReference.getMName();
Object[] enableAccessibilityCallPropOperands = new Object[] { enableAccessibilityName, 0 };
for (String accessibilityClassName : accessibleClassNames)
{
IResolvedQualifiersReference ref = ReferenceFactory.packageQualifiedReference(flexProject.getWorkspace(),
accessibilityClassName);
Name accName = ref.getMName();
initMethod.addInstruction(ABCConstants.OP_getlex, accName);
initMethod.addInstruction(ABCConstants.OP_callproperty, enableAccessibilityCallPropOperands);
initMethod.addInstruction(ABCConstants.OP_pop);
}
initMethod.labelNext(accessibilityEnd);
}
// register class aliases
if (!remoteClassAliasMap.isEmpty())
{
Name getClassByAliasName = getClassByAliasReference.getMName();
Name registerClassAliasName = registerClassAliasReference.getMName();
Object[] getClassByAliasCallPropOperands = new Object[] { getClassByAliasName, 1 };
Object [] registerClassAliasCallPropOperands = new Object[] { registerClassAliasName, 2 };
for (Map.Entry<ClassDefinition, String> classAliasEntry : remoteClassAliasMap.entrySet())
{
Label tryLabel = new Label();
initMethod.labelNext(tryLabel);
initMethod.addInstruction(ABCConstants.OP_finddef, getClassByAliasName);
initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
initMethod.addInstruction(ABCConstants.OP_callproperty, getClassByAliasCallPropOperands);
Name classMName = classAliasEntry.getKey().getMName(flexProject);
initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
Label endTryLabel = new Label();
initMethod.addInstruction(ABCConstants.OP_ifeq, endTryLabel);
initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
initMethod.addInstruction(ABCConstants.OP_getlex, classMName);
initMethod.addInstruction(ABCConstants.OP_callpropvoid, registerClassAliasCallPropOperands);
initMethod.labelNext(endTryLabel);
Label afterCatch = new Label();
initMethod.addInstruction(ABCConstants.OP_jump, afterCatch);
Label catchLabel = new Label();
initMethod.labelNext(catchLabel);
initMethod.addInstruction(ABCConstants.OP_pop);
initMethod.addInstruction(ABCConstants.OP_finddef, registerClassAliasName);
initMethod.addInstruction(ABCConstants.OP_pushstring, classAliasEntry.getValue());
initMethod.addInstruction(ABCConstants.OP_getlex, classMName);