{
// Push the value of the element we're setting.
// Note: Here we call processNode() on each child,
// rather than calling traverse(), because we need to emit
// code before and after each element value push.
IMXMLInstanceNode elementNode = (IMXMLInstanceNode)vectorNode.getChild(i);
processNode(elementNode, context);
}
// the type hint and conversion function add 2
context.addInstruction(OP_newarray, context.numArrayValues + 2);
context.makingArrayValues = false;
}
else
{
// Synthesize the class Vector.<T>.
context.addInstruction(OP_getlex, vectorName);
context.addInstruction(OP_getlex, typeName);
context.addInstruction(OP_applytype, 1);
// Call the Vector.<T> constructor with 1 or two arguments.
// The first is the number of elements.
// The second is 'fixed', which defaults to false.
context.pushNumericConstant(n);
if (fixed)
context.addInstruction(OP_pushtrue);
context.addInstruction(OP_construct, fixed ? 2 : 1);
// Set each element of the vector.
for (int i = 0; i < n; i++)
{
// Push the vector instance whose element we're setting.
context.addInstruction(OP_dup);
// Push the index of the element we're setting.
context.pushNumericConstant(i);
// Push the value of the element we're setting.
// Note: Here we call processNode() on each child,
// rather than calling traverse(), because we need to emit
// code before and after each element value push.
IMXMLInstanceNode elementNode = (IMXMLInstanceNode)vectorNode.getChild(i);
processNode(elementNode, context);
// Set the element to the value.
// This will pop the previous three values.
context.addInstruction(OP_setproperty, indexName);