* @return An InstructionList that contains the instructions to set the
* target expression
*/
private InstructionList getTargetInstructions(IMXMLUnitData data, IMXMLTagAttributeData attr)
{
IMXMLUnitData d = data;
Stack<IMXMLUnitData> parentStack = new Stack<IMXMLUnitData>();
if (isOnlyTextChild(d))
{
// If we are the only text child of a TagData, then start with the TagData,
// as that is what we'll be setting
d = d.getParentUnitData();
}
IMXMLUnitData target = d;
// push parents onto a stack, so we can walk down from the parent later
while (d != null)
{
parentStack.add(d);
d = d == rootTag ? null : d.getParentUnitData();
}
InstructionList il = new InstructionList();
// we're always going to start with "this"
il.addInstruction(ABCConstants.OP_getlocal0);
// Walk down the parent stack, and emit get instructions for each tag
// except for the last one, which is the one we're targeting
while (parentStack.size() > 1)
{
IMXMLUnitData unitData = parentStack.pop();
if (unitData instanceof IMXMLTagData)
{
generateGetInstructions(il, (IMXMLTagData)unitData);
}
}